julia
6adb4cf3 - Random: allow seeding from an RNG (#51533)

Commit
275 days ago
Random: allow seeding from an RNG (#51533) This is the combination of two changes: 1) Allow seeding an RNG from another RNG, e.g. `seed!(Xoshiro(), RandomDevice())`, because it's convenient, in particular for RNGs which need a variable number of random bytes (think "rejection sampling"). 2) In turn, it's convenient to only having to define this one method for a given RNG type, and delegate handling of other kind of seeds (integer, strings, ...) to another object: `SeedHasher(seed)` is a new RNG which produces random streams from such seeds, with the help of SHA2; this essentially gives an RNG API to what we are already using to transform integer seeds for `Xoshiro` and `MersenneTwister` into vectors suitable for their initialization. While `SeedHasher` shouldn't be considered as a CSPRNG, it should have very good statistical properties; if we go with this PR, I will first run PractRand (looks good so far) and BigCrush tests before merging. The API is not changed in this PR, `SeedHasher` remains internal; the goal is to experiment more with it before commiting to an API, possibly in v1.13.
Author
Loading