-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move all *Rng
wrappers to rngs
module
#430
Conversation
It would be good to get more feedback on this (bearing in mind that the
The above re-ordering is in my opinion workable but probably not optimal. I'm wondering about an alternative like:
|
@pitdicker still waiting to hear your thoughts on my alternative proposal ↑. Putting the three external RNGs into an "entropy" module sounds okay to me. |
Sorry, I didn't have much time yesterday. I still think roughly the same as in #423 (comment). It would loose the advantage of having everything in one module. If you look at it one way the rngs all offer pretty different functionality, in another they all just implement I think it gives a nice symmetry with the I think you wrote that it would split rand in two (can't find the comment). That is kind of the idea I had in mind, one part that deals with generating random numbers, another to transform it to the right types and distributions. |
Personally I don't think all these "RNGs" fit together. As for |
I think we should take some inspiration from the
I'll have a go at re-organising. I think we can still use some of the new doc you wrote 😄 |
Closing in favour of #435. |
This is the first commit of #423, moved out to help reviewing.
The idea is to move all
*Rng
wrappers to anrngs
module, similar to how everything distribution-related is in thedistributions
module.This gives a nice clean-up of our exports from the to level, which now includes many things, and some are things 99% of the users of Rand would not need. We had complaints about the number of items there before (can't remember where). And a separate module provides a nice place for more targeted documentation.
The RNGs moved to the new module are:
StdRng
SmallRng
ThreadRng
EntropyRng
JitterRng
(including the publicTimerError
)OsRng
ReadRng
ReseedingRng
Modules with only one type are no longer exposed, so no more
os
,jitter
orread
modules. The structure of the old modules is recreated using re-exports, but hidden in the documentation. That will give a problem in the future, do we want to remove those compatibility re-exports someday? As far as I know there is no way to give deprecation warnings.I only kept
StdRng
andSmallRng
as re-exports in the top-level module as items that should not be deprecated, they kind of deserve to be there in my opinion.the
random
andthread_rng
functions are moved from thethread_rng
module to the top-level module, to have a cleaner story for therngs
module. The separation meant I had to addThreadRng::new()
, but it ispub(crate)
until #404 is settled. I am for exposing both b.t.w., I see little trouble in it.