Created
March 19, 2019 17:13
-
-
Save Marc-B-Reynolds/9dfc9015620c77fc38257826abdaf8d2 to your computer and use it in GitHub Desktop.
tweet dep break-up details
This file contains hidden or 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
// SEE: https://lemire.me/blog/2019/03/19/the-fastest-conventional-random-number-generator-that-can-pass-big-crush/ | |
__uint128_t g_lehmer64_state; | |
uint64_t lehmer64() { | |
uint64_t r = (g_lehmer64_state >> 64); | |
g_lehmer64_state *= 0xda942042e4dd58b5; | |
return r; | |
} | |
uint64_t wyhash64_x; | |
uint64_t wyhash64() | |
{ | |
//wyhash64_x += 0x60bee2bee120fc15; | |
__uint128_t tmp; | |
tmp = (__uint128_t) wyhash64_x * 0xa3b195354a39b70d; | |
wyhash64_x += 0x60bee2bee120fc15; | |
uint64_t m1 = (tmp >> 64) ^ tmp; | |
tmp = (__uint128_t)m1 * 0x1b03738712fad5c9; | |
uint64_t m2 = (tmp >> 64) ^ tmp; | |
return m2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment