-
-
Notifications
You must be signed in to change notification settings - Fork 478
Description
Originally posted by @Bluefinger in #1643:
As a third party using
rand_core/randfor other projects, I do think something likeOsRngbelongs togetrandom, since it is exactly the purview ofgetrandomto provide OS entropy sources. To my brain, the puzzle piece just fits. That said, keepinggetrandomlean is another consideration (if seeking to avoid adding features), so anos-rngcrate probably would be a good alternative. Being able to depend on smaller, more focused crates is just nicer and preferable, else I'll probably end up rigging up my ownOsRngif it means not needing to depend directly onrandif I can help it. However, that might not be too big of a concern, because the main crate I maintain is for a bevy plugin, and bevy already depends onrandanyway...So all in all, might not actually matter either way. Just yeah, I like smaller crates where possible, but I am not going to lose sleep over it 😄
Reply by @newpavlov:
How about introducing an
os-rngcrate (or with some other name) and add to it not onlyOsRng(which I would prefer to rename toSysRngand makeOsRnga deprecated type alias), but alsoThreadRngbehind a crate feature?It would not only allow us to use
ThreadRngwithout the rest ofrand, but also on some platformsOsRngalready uses a user-space PRNG (e.g. Windows) and it would be more efficient to use it directly forThreadRng.