mirror of
https://github.com/php/php-src.git
synced 2025-01-23 20:23:31 +08:00
Fixed bug #25170 (Problem with generation of random numbers on solaris)
This commit is contained in:
parent
d70f744a63
commit
ece0a731e9
@ -33,7 +33,7 @@
|
||||
#define RAND_MAX (1<<15)
|
||||
#endif
|
||||
|
||||
#if HAVE_LRAND48 && !defined(__sun)
|
||||
#if defined(HAVE_LRAND48) || defined(HAVE_RANDOM)
|
||||
#define PHP_RAND_MAX 2147483647
|
||||
#else
|
||||
#define PHP_RAND_MAX RAND_MAX
|
||||
|
@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include "php_reentrancy.h"
|
||||
#include "ext/standard/php_rand.h" /* for RAND_MAX */
|
||||
#include "ext/standard/php_rand.h" /* for PHP_RAND_MAX */
|
||||
|
||||
enum {
|
||||
LOCALTIME_R,
|
||||
@ -368,7 +368,7 @@ void reentrancy_shutdown(void)
|
||||
static int
|
||||
do_rand(unsigned long *ctx)
|
||||
{
|
||||
return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
|
||||
return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)PHP_RAND_MAX + 1));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user