Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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
primeos-work added a commit to science-computing/butido that referenced this pull request Feb 3, 2025
Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.0.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](rust-random/rand@0.8.5...0.9.0)

---
updated-dependencies:
- dependency-name: rand
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

The function `rand::thread_rng()` got renamed to `rand::rng()`:
rust-random/rand#1506

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Michael Weiss <michael.weiss@eviden.com>
benjamin-lieser pushed a commit to benjamin-lieser/rand that referenced this pull request Feb 5, 2025
- Rename `rand::thread_rng()` → `rand::rng()`
- Remove `thread_rng()` and `random()` from the prelude
benjamin-lieser pushed a commit to benjamin-lieser/rand that referenced this pull request Feb 5, 2025
- Rename `rand::thread_rng()` → `rand::rng()`
- Remove `thread_rng()` and `random()` from the prelude
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants