]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #25170 (Problem with generation of random numbers on solaris)
authorIlia Alshanetsky <iliaa@php.net>
Wed, 20 Aug 2003 16:40:46 +0000 (16:40 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 20 Aug 2003 16:40:46 +0000 (16:40 +0000)
ext/standard/php_rand.h
main/reentrancy.c

index 1d6dd39384ee233dc72ad8dbe85a9ec10499351d..e72f3ed02d542eccee290563c2d84a976c0fb3c1 100644 (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
index e5354891e41da77433882a536881e1c7801d7770..b2a4c8eb60f89621b9fc96b56ec529852172d038 100644 (file)
@@ -34,7 +34,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,
@@ -367,7 +367,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));
 }