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

thread_rng() → rand::rng() #1506

Merged
merged 6 commits into from
Oct 11, 2024
Merged

thread_rng() → rand::rng() #1506

merged 6 commits into from
Oct 11, 2024

Conversation

dhardy
Copy link
Member

@dhardy dhardy commented Oct 9, 2024

  • Added a CHANGELOG.md entry

Summary

  • Rename rand::thread_rng()rand::rng()
  • Remove thread_rng() and random() from the prelude

Motivation

Make this frequently used function easier to type. The "thread-local" part is a design decision which does not (usually) need to be considered during usage, and thus should not be part of the name. See #989.

Details

ThreadRng is not renamed since thread-locality is a key part of its identity, and it is less commonly used directly. Also, the name rand::Rng is already taken.

@dhardy dhardy changed the title Thread rng thread_rng() → rand::rng() Oct 9, 2024
@dhardy dhardy merged commit f5185d9 into rust-random:master Oct 11, 2024
15 checks passed
@dhardy dhardy deleted the thread_rng branch October 11, 2024 08:13
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

Successfully merging this pull request may close these issues.

2 participants