diff options
Diffstat (limited to 'ext/standard/php_rand.h')
-rw-r--r-- | ext/standard/php_rand.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index 7ef8b6d9ab..3cc4296d94 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -36,4 +36,26 @@ #define PHP_RAND_MAX RAND_MAX #endif +/* Define rand Function wrapper */ +#ifdef HAVE_RANDOM +#define php_rand() random() +#else +#ifdef HAVE_LRAND48 +#define php_rand() lrand48() +#else +#define php_rand() rand() +#endif +#endif + +/* Define srand Function wrapper */ +#ifdef HAVE_SRANDOM +#define php_srand(seed) srandom((unsigned int)seed) +#else +#ifdef HAVE_SRAND48 +#define php_srand(seed) srand48((long)seed) +#else +#define php_srand(seed) srand((unsigned int)seed) +#endif +#endif + #endif /* PHP_RAND_H */ |