Created
June 10, 2018 16:35
-
-
Save warmwaffles/a3988b2a50a8608b01d9f256a35569b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
uint64_t s[2]; | |
uint64_t | |
xorshiftrng128(void) | |
{ | |
uint64_t s1 = s[0]; | |
uint64_t s0 = s[1]; | |
uint64_t result = s0 + s1; | |
s[0] = s0; | |
s1 ^= s1 << 23; // a | |
s[1] = s1 ^ s0 ^ (s1 >> 18) ^ (s0 >> 5); // b, c | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment