diff options
Diffstat (limited to 'include/xorshift64.h')
| -rw-r--r-- | include/xorshift64.h | 18 |
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 |
