Closed ironhaven closed 4 months ago
This slipped through the cracks. I'm not familiar enough with wyrand
to know if this improves or doesn't improve randomness.
This slipped through the cracks. I'm not familiar enough with
wyrand
to know if this improves or doesn't improve randomness.
This is a holdover from when fastrand
was based on PCG, not WyRand. And the C reference implementation doesn't do anything to avoid the non-zero seed: https://github.com/wangyi-fudan/wyhash/blob/master/wyhash.h#L151
However, if we modify the seed, it will a breaking change as the output will no longer quite be the same per sequence. And probably, if we are to change the output, I would suggest updating the constants in fastrand
to use the final v4.2 ones as defined in the C reference, which should help to improve the entropy quality somewhat (though that can be another PR).
Because the first step of wyrand is an addition with a constant, a non-zero seed is not required