aboutsummaryrefslogtreecommitdiff
path: root/include/xorshift64.h
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-23 18:20:05 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit18496a371a2204e8c1b448921a87108f4aa7ada3 (patch)
treea2a0882c46882f40cd00906e59f52a0a0118a794 /include/xorshift64.h
parent2439dc2ab6a6c2a840c2d2c1deb3949b7b88f415 (diff)
Attempting Zobrist hashing
Diffstat (limited to 'include/xorshift64.h')
-rw-r--r--include/xorshift64.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/xorshift64.h b/include/xorshift64.h
new file mode 100644
index 0000000..a12a38d
--- /dev/null
+++ b/include/xorshift64.h
@@ -0,0 +1,18 @@
+#include <stdint.h>
+
+#ifndef XORSHIFT_H
+#define XORSHIFT_H
+
+extern uint64_t xors;
+
+#define XORSHIFT { \
+ xors ^= xors >> 12; \
+ xors ^= xors << 25; \
+ xors ^= xors >> 27; \
+ xors *= 0x2545F4914F6CDD1D; \
+ }
+
+#define RANDOM64 (xors)
+#define RANDOM32 ((uint32_t)xors)
+
+#endif