Skip to content
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

Consider renaming RngCoreto BitRng #1045

Closed
vks opened this issue Sep 18, 2020 · 3 comments
Closed

Consider renaming RngCoreto BitRng #1045

vks opened this issue Sep 18, 2020 · 3 comments

Comments

@vks
Copy link
Collaborator

vks commented Sep 18, 2020

Looking at the redesign of numpy.random, I realized that their API became more similar to ours. Their Generator class is almost equivalent to our Rng trait, and their BitGenerator class is very similar to RngCore + SeedableRng. I like their names more than ours, because BitGenerator seems more descriptive than RngCore. Maybe it is worth the churn to rename it to BitRng for Rand 1.0?

(Other observations are that their API allows for drawing an arbitrary number number of samples, which is more vectorization friendly than our API. It also seems like they deprecated their global RNG! They also added a SeedSequence class (based on this), which is similar to rand_seeder.)

@dhardy
Copy link
Member

dhardy commented Oct 9, 2020

No, I don't think the name is sufficiently better to justify this kind of API churn. BitRng is also not as clear in purpose as BitGenerator.

We already do have a way of extracting arbitrary amounts of random data: fill_bytes. Sure, we still don't have nice APIs for stuff like filling a matrix with uniform samples from 0..1, but that's probably more a feature for a linear-algebra library (as in numpy).

There are some rationales for removing our thread_rng (e.g. #968, #996), but for the most part those are solvable bugs, and the only real limitations are (1) some memory usage per thread (though very little when not used), (2) embedded compatibility without standard thread/sync machinery — though for the most part the main rand lib is not embedded friendly anyway and (3) code size — though we would still import ChaCha for StdRng so this shouldn't be a big deal.

So... no to all suggestions?

@newpavlov
Copy link
Member

Even not considering the churn, I disagree that BitRng is a better name than RngCore. I think think that it will be confusing, because I for one would read it "RNG for generating bits".

@dhardy
Copy link
Member

dhardy commented Oct 19, 2020

So lets close this.

@dhardy dhardy closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants