summaryrefslogtreecommitdiff
path: root/src/prng
diff options
context:
space:
mode:
Diffstat (limited to 'src/prng')
-rw-r--r--src/prng/rand.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/prng/rand.c b/src/prng/rand.c
index e3ce6347..c000cd24 100644
--- a/src/prng/rand.c
+++ b/src/prng/rand.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
+#include <stdint.h>
-static unsigned seed;
+static uint64_t seed;
void srand(unsigned s)
{
@@ -9,5 +10,6 @@ void srand(unsigned s)
int rand(void)
{
- return (seed = (seed+1) * 1103515245 + 12345 - 1)+1 & 0x7fffffff;
+ seed = 6364136223846793005ULL*seed + 1;
+ return seed>>33;
}