Fixed bug #25170 (Problem with generation of random numbers on solaris)

This commit is contained in:
Ilia Alshanetsky 2003-08-20 16:40:22 +00:00
parent d70f744a63
commit ece0a731e9
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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));
}