1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef PHP_RAND_H
- #define PHP_RAND_H
- #include "php_lcg.h"
- #include "php_mt_rand.h"
- #ifndef RAND_MAX
- #define RAND_MAX PHP_MT_RAND_MAX
- #endif
- #define PHP_RAND_MAX PHP_MT_RAND_MAX
- #define RAND_RANGE_BADSCALING(__n, __min, __max, __tmax) \
- (__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
- #ifdef PHP_WIN32
- #define GENERATE_SEED() (((zend_long) (time(0) * GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
- #else
- #define GENERATE_SEED() (((zend_long) (time(0) * getpid())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
- #endif
- PHPAPI void php_srand(zend_long seed);
- PHPAPI zend_long php_rand(void);
- #endif
|