summaryrefslogtreecommitdiff
path: root/src/prng/rand_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prng/rand_r.c')
-rw-r--r--src/prng/rand_r.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/prng/rand_r.c b/src/prng/rand_r.c
new file mode 100644
index 00000000..e96cfba9
--- /dev/null
+++ b/src/prng/rand_r.c
@@ -0,0 +1,6 @@
+#include <stdlib.h>
+
+int rand_r(unsigned *seed)
+{
+ return (*seed = *seed * 1103515245 + 12345) & 0x7fffffff;
+}