-
Notifications
You must be signed in to change notification settings - Fork 2
Description
On rust-lang/rfcs#2106 (comment) I argued that rand should not provide any specific/named rngs (so no ChaChaRng, XoroShiro, etc.) but instead provide a very small set of generators (OsRng, StdRng, etc.) in addition to the trait machinery, etc..
Consider just WeakRng for example (StdRng might be enough moving forward), there were almost half a dozen proposals to improve it. One can argue that the initial choice wasn't the best but it's bound to happen again no matter the upfront effort.
In the event that rand keeps providing specific Rngs, proposals with merits will eventually come and the crate will be tied to the older variant until the next major version (w/ a higher friction upgrade). Until that happens the maintainers have a few choices:
- Reject the PR (for reason X, even if its a win) and ask the author to push it to crates.io instead
- Accept the PR adding generator G to rand
- Accept the PR adding generator G to rand and mark the other(s) deprecated
Note that 2 and 3 are likely duplicating something from crates.io, but with a blessing.
Advantages
randprovide easy to reason generator(s) to satisfy the bulk of the usersrandprovides low-friction upgrades and keeps the optimal-ish algorithms readily availablerandwill not accumulate and/or deprecate specific algorithms throughout time- Specific
randRng names won't bleed out to the world, like in forum posts, stackoverflow, etc..
Disadvantages
- There will be no blessed specific Rng implementations
- Major versions bumps are required, whereas providing specific implementations can get away with new Rngs and give or take a deprecation warning.
Non concerns
- Reproducibility/_Seed_ability can still be guaranteed across major versions.
- If the user needs a specific Rng it should reach out to a crate (crates.io raison d'être)