Random number generators
Jump to navigation
Jump to search
pcg32()
// https://twitter.com/zeuxcg/status/1363143368033755136
uint32_t pcg32(uint64_t* s) {
uint32_t x = ((*s >> 18u) ^ *s) >> 27u;
uint32_t r = *s >> 59u;
*s = *s * 6364136223846793005ULL + 1;
return (x >> r) | (x << ((-r) & 31));
}