This PR contains a number of vaguely-related improvements to the random module.
The specific changes and more detailed rationale is in the commit messages, but the highlights are:
XoRoShiRo128PlusPlus(previously a test-only RNG) moves to random.h and becomesInsecureRandomContext, which is even faster thanFastRandomContextbut non-cryptographic. It also gets all helper randomness functions (randrange,fillrand, …), making it a lot more succinct to use.- During tests, all randomness is made deterministic (except for
GetStrongRandBytes) but non-repeating (likeGetRand()used to be wheng_mock_deterministic_testswas used), either fixed, or from a random seed (overridden by env var). - Several infrequently used top-level functions (
GetRandMillis,GetRandMicros,GetExponentialRand) are converted into member functions ofFastRandomContext(andInsecureRandomContext). GetRand<T>()(without argument) can now return the maximum value of the type (previously e.g.GetRand<uint32_t>()would never return 0xffffffff).