about summary refs log tree commit diff
path: root/src/prng/mrand48.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prng/mrand48.c')
-rw-r--r--src/prng/mrand48.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/prng/mrand48.c b/src/prng/mrand48.c
new file mode 100644
index 00000000..ee650fc3
--- /dev/null
+++ b/src/prng/mrand48.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include <inttypes.h>
+
+uint64_t __rand48_step(unsigned short *xi, unsigned short *lc);
+extern unsigned short __seed48[7];
+
+long jrand48(unsigned short s[3])
+{
+	return __rand48_step(s, __seed48+3) >> 16;
+}
+
+long mrand48(void)
+{
+	return jrand48(__seed48);
+}