Dereferencing partially uninitialized memory as a random number
Corillian opened this issue · comments
Keith Newton commented
It appears that every second iteration of MWC64::next()
you are returning the value of _index
, which will always be 1, along with 4 bytes of potentially uninitialized memory - which I suppose does introduce some amount of randomness :p. This is because (&_value + 1) == ((uint64_t*)&_index)
except that _index
is an int
.
Line 49 in c5b954e
Bobby Powers commented
@Corillian eep! amazing find, sorry it took so long to get back to you. This was indeed a pretty glaring bug, which should be fixed now.
Thanks again!