about summary refs log tree commit diff
path: root/src/prng/lrand48.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prng/lrand48.c')
-rw-r--r--src/prng/lrand48.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/prng/lrand48.c b/src/prng/lrand48.c
new file mode 100644
index 00000000..a3c4e4e2
--- /dev/null
+++ b/src/prng/lrand48.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 nrand48(unsigned short s[3])
+{
+	return __rand48_step(s, __seed48+3) >> 17;
+}
+
+long lrand48(void)
+{
+	return nrand48(__seed48);
+}