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

removing from_entropy from SmallRng breaks what i think is a common usage #1443

Closed
tenturestept opened this issue May 1, 2024 · 4 comments
Closed

Comments

@tenturestept
Copy link

tenturestept commented May 1, 2024

Background

What is your motivation?

i want to use rand for regular random numbers in a simple game. i don't want to bloat the executable size with a chacha-based rng so i use only features = ["std", "small_rng", "getrandom"].

in 1db3aa4, SmallRng stopped impling SeedableRng and lost the from_entropy factory method.

for me it was very convenient to have SmallRng seedable from getrandom using from_entropy. the from_thread_rng method is not useful since i don't enable the std_rng feature.

i think removing from_entropy breaks a common use-case. that is:

  1. i want basic random numbers.
  2. i don't care about reproducibility, i.e. they should be different every execution.
  3. i want minimal compile times and code size.

obviously i can easily seed it myself using the getrandom crate but the previous situation was easier.

What type of application is this? (E.g. cryptography, game, numerical simulation)

game

Feature request

bring back from_entropy?

@tenturestept tenturestept changed the title removing from_entropy from SmallRng in 1db3aa416c breaks what i think is a common usage removing from_entropy from SmallRng breaks what i think is a common usage May 1, 2024
@dhardy
Copy link
Member

dhardy commented May 1, 2024

#1368 notes this loss, without any justification:

Some tests failed because SmallRng::from_entropy is missing. But do we want this anyway?

You have provided justification with the above, so please go ahead and make a PR adding from_entropy (as an inherent method).

@Lucretiel
Copy link
Contributor

Why was SeedableRng removed from SmallRng in the first place? Doesn't it have a state that can be initialized from a seed?

@dhardy
Copy link
Member

dhardy commented May 21, 2024

To fix #1285, removing from_seed, which is misleading in that it advertises portability which the generator lacks.

@dhardy dhardy added the E-easy Participation: easy job label Jul 8, 2024
@dhardy dhardy removed the E-easy Participation: easy job label Jul 26, 2024
@dhardy
Copy link
Member

dhardy commented Jul 26, 2024

SeedableRng was re-implemented in #1455.

@dhardy dhardy closed this as completed Jul 26, 2024
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