summaryrefslogtreecommitdiffstats
path: root/src/isaac_rand/isaac64.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/isaac_rand/isaac64.h')
-rw-r--r--src/isaac_rand/isaac64.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/isaac_rand/isaac64.h b/src/isaac_rand/isaac64.h
new file mode 100644
index 0000000..e2ab55b
--- /dev/null
+++ b/src/isaac_rand/isaac64.h
@@ -0,0 +1,41 @@
+/*
+------------------------------------------------------------------------------
+isaac64.h: definitions for a random number generator
+Bob Jenkins, 1996, Public Domain
+------------------------------------------------------------------------------
+*/
+#ifndef ISAAC64
+#define ISAAC64
+
+#include "isaac_standard.h"
+
+struct rand64ctx
+{
+ ub8 randrsl[RANDSIZ], randcnt;
+ ub8 mm[RANDSIZ];
+ ub8 aa, bb, cc;
+};
+typedef struct rand64ctx rand64ctx;
+
+/*
+------------------------------------------------------------------------------
+ If (flag==TRUE), then use the contents of randrsl[0..255] as the seed.
+------------------------------------------------------------------------------
+*/
+void rand64init(rand64ctx *r, word flag);
+
+void isaac64(rand64ctx *ctx);
+
+
+/*
+------------------------------------------------------------------------------
+ Call rand64() to retrieve a single 64-bit random value
+------------------------------------------------------------------------------
+*/
+#define isaac64_rand() \
+ (!(r)->randcnt-- ? \
+ (isaac64(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->>randcnt]) : \
+ (r)->randrsl[(r)->randcnt])
+
+#endif /* ISAAC64 */
+