summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 */