-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
If we are emphasising that the seeded rng is being used for deterministic purposes, then we kinda shouldn't be using
StdRngin the first place.StdRngis documented as being deterministic in output, but not portable, so there is no assurance that the output will be the same on different platforms or different versions ofrand. And if we are testing across different platforms, we'd then expect the output to match across all platforms. For further reference from theranddocumentation, their documented expectations for portability/determinism.Given
randminor versions might in the future change the underlying algorithm forStdRng, end users might find their tests breaking if they usedStdRngin their tests after basing them on our examples. Better to instead encourage using the algorithm crates directly if they want to have that extra assurance in determinism. Currently,rand_chachais what is the underlying algorithm forStdRng, specificallyChaCha12Rng. For game dev purposes,ChaCha8Rngwould be a better fit to provide higher throughput at the expense of some entropy quality (though it will still be far better than what is probably required).
Originally posted by @Bluefinger in #12593 (comment)
I think a good PR would be to replace all usage of StdRng with ChaCha8Rng, as suggested by @Bluefinger. There are also a few examples that use hashing instead of a proper RNG function that could benefit from switching too.