summaryrefslogtreecommitdiff
path: root/ext/standard/rand.c
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2001-09-16 17:37:19 +0000
committerSterling Hughes <sterling@php.net>2001-09-16 17:37:19 +0000
commit96763e8372497ddf6ee725f194b142a7534e777d (patch)
tree00be4f831b4d0797f7b4fb10e71f14ce10aef810 /ext/standard/rand.c
parentf88c25b60efad1c2d2d44eb9dd3b128062144dd2 (diff)
downloadphp-git-96763e8372497ddf6ee725f194b142a7534e777d.tar.gz
Hopefully fix compile warnings on win32 systems
Diffstat (limited to 'ext/standard/rand.c')
-rw-r--r--ext/standard/rand.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 50f09e2e4c..e68acad46f 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -24,9 +24,14 @@
#include <stdlib.h>
+#ifdef PHP_WIN32
+#include <windows.h>
+#endif
+
#include "php.h"
#include "php_math.h"
#include "php_rand.h"
+#include "php_lcg.h"
#include "basic_functions.h"
@@ -192,7 +197,11 @@ PHPAPI php_uint32 php_mt_rand(TSRMLS_D)
return y ^ (y >> 18);
}
+#ifdef PHP_WIN32
+#define GENERATE_SEED() (time(0) * GetCurrentProcessId() * 1000000 * php_combined_lcg(TSRMLS_C))
+#else
#define GENERATE_SEED() (time(0) * getpid() * 1000000 * php_combined_lcg(TSRMLS_C))
+#endif
/* {{{ proto void srand([int seed])
Seeds random number generator */