summaryrefslogtreecommitdiff
path: root/xorshift.h
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-02-09 18:04:22 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-05-02 21:36:44 +0200
commite98d15d4eb88ec13a6e6ef97e915aada231855fa (patch)
tree3e8eac4b4da2e33551e98b36995a4a9eee9f7728 /xorshift.h
parent9cdac5c8de53244dcd19aa15d646c022a2614c24 (diff)
downloadpucket-e98d15d4eb88ec13a6e6ef97e915aada231855fa.tar.gz
pucket-e98d15d4eb88ec13a6e6ef97e915aada231855fa.tar.bz2
pucket-e98d15d4eb88ec13a6e6ef97e915aada231855fa.zip
Replace isaac with xorshift
No difference in performance. rdrand instruction alone is too slow.
Diffstat (limited to 'xorshift.h')
-rw-r--r--xorshift.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/xorshift.h b/xorshift.h
new file mode 100644
index 0000000..64c3ea2
--- /dev/null
+++ b/xorshift.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <stdint.h>
+
+#define XORSHIFT_S 16
+
+typedef struct {
+ uint64_t s[XORSHIFT_S];
+ int p;
+} randctx;
+
+uint64_t xorshift_step (randctx * const st);
+void xorshift_seed (randctx * const st);
+