6 ms·
Here's a variant which gives 64-bit output: uint64_t x = 0, w = 1; uint64_t msws64(void) { x = x * x + (w *= 0xe9acc0f334e93bd5ULL); return (x
by eutectic 3y ago
Here's a variant which gives 64-bit output:
uint64_t x = 0, w = 1;
uint64_t msws64(void) {
x = x * x + (w *= 0xe9acc0f334e93bd5ULL);
return (x = (x >> 32) | (x << 32)) ^ w;
}
- deleted 2y ago[deleted]
- camel-cdr 2y agoI wouldn't recemmend that without a 128 bit variables. The truncation is required to make the generator non predictable, otherwise you leak to much state. Alternatively, you can just call the 32 bit one twice and build a 64 bit value from the results. Edit: I didn't see that you changed the algorithm more than removing the truncation. It is honestly suprizingly good for exposing that much state, but it fails PractRand after 16 GB. It is honestly suprizingly good and hasn't failed PractRand yet (I'm at >64 GB).