-
-
Notifications
You must be signed in to change notification settings - Fork 474
Description
This type is introduced as follows:
An RNG recommended when small state, cheap initialization and good
performance are required. The PRNG algorithm inSmallRng
is chosen to be
efficient on the current platform, without consideration for cryptography
or security. The size of its state is much smaller than forStdRng
.
There is general consensus that the current algorithm, Xorshift, is not an ideal choice due to quality (poor results in PractRand and BigCrush) and trivial predictability (to the point that seeding one instance from another effectively creates a clone). Ideally we should replace this for the 0.6 release.
Existing work:
- Move PRNG algorithms out of Rand #431 lists a rough plan for introducing additional generators but does not concern
SmallRng
directly - To provide (or not) specific PRNGs? dhardy/rand#58 is an older discussion on the same problem
- Requirements for a small fast RNG dhardy/rand#60 includes detailed evaluations of many candidate algorithms by @pitdicker
- Shootout: small, fast PRNGs dhardy/rand#52 is a parallel discussion to Requirements for a small fast RNG dhardy/rand#60
- pitdicker/small-rngs is a repo implementing these candidates
- Remove
weak_rng
andrandom
? #289 discusses replacingweak_rng
withSmallRng
I'm creating this new issue for visibility (most of the previous discussions happened on a fork) and to refresh this issue.
(First note: "reproducible" is used here to mean deterministic, portable, and a commitment not to tweak the algorithm in future updates. All reproducible PRNGs should eventually be migrated out of Rand proper to sub-libs, as discussed in dhardy#58 and #431.)
Question 1: is the current API with two non-reproducible PRNGs, StdRng
and SmallRng
, the right one? As I understand the current choice is reasonably well accepted, although there have been suggestions to add more categories of PRNG.
Question 2: which algorithm should we use for SmallRng
? (The choice may vary by platform.)