Skip to content

Rename RandomSource -> Rng, DefaultRandomSource -> SystemRng#157539

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
joshtriplett:random-source-rename
Jun 17, 2026
Merged

Rename RandomSource -> Rng, DefaultRandomSource -> SystemRng#157539
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
joshtriplett:random-source-rename

Conversation

@joshtriplett

@joshtriplett joshtriplett commented Jun 6, 2026

Copy link
Copy Markdown
Member

Per naming bikeshed in libs-api. Rng is shorter, and already established in the ecosystem. System makes it self-documenting that SystemRng gets its randomness from the system RNG.

This also makes it short and convenient to write SystemRng.fill_bytes, rather than DefaultRandomSource.fill_bytes.

@joshtriplett joshtriplett added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jun 6, 2026
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 6, 2026
@joshtriplett joshtriplett marked this pull request as ready for review June 6, 2026 17:43
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 6, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 6, 2026
@rustbot

rustbot commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 11 candidates
  • Random selection from LawnGnome, Mark-Simulacrum, aapoalas, clarfonthey, jhpratt

@rust-log-analyzer

This comment has been minimized.

Comment thread library/std/src/random.rs Outdated
@jhpratt

jhpratt commented Jun 6, 2026

Copy link
Copy Markdown
Member

Looks like a simple change; r=me once CI is passing. Address the comment at your discretion.

@joboet

joboet commented Jun 6, 2026

Copy link
Copy Markdown
Member

I don't really want to bikeshed this all over again, but how about calling this SystemRng? We have precedent for System already: the System allocator and SystemTime, whereas the abbreviation isn't used anywhere else.

@joshtriplett

Copy link
Copy Markdown
Member Author

@joboet SysRng has precedent in the ecosystem, but you're right that Sys doesn't have precedent in the standard library. Brevity is a virtue; so is precedent. Sigh.

@joshtriplett

Copy link
Copy Markdown
Member Author

Looks like a simple change; r=me once CI is passing. Address the comment at your discretion.

I'm trying to figure out what the CI issue is. Currently re-running it because it's not clear to me if it's spurious or not.

Per naming bikeshed in libs-api. `Rng` is shorter, and already
established in the ecosystem. `System` makes it self-documenting that
`SystemRng` gets its randomness from the system RNG.
@joshtriplett joshtriplett force-pushed the random-source-rename branch from 431abc5 to 0e51988 Compare June 16, 2026 19:08
@joshtriplett joshtriplett changed the title Rename RandomSource -> Rng, DefaultRandomSource -> SysRng Rename RandomSource -> Rng, DefaultRandomSource -> SystemRng Jun 16, 2026
@joshtriplett

Copy link
Copy Markdown
Member Author

@bors r=jhpratt rollup

@rust-bors

rust-bors Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0e51988 has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 16, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 17, 2026
Rollup of 7 pull requests

Successful merges:

 - #157681 (Add instrument_fn attribute)
 - #149219 (Allow shortening lifetime in CoerceUnsized for &mut)
 - #157539 (Rename `RandomSource` -> `Rng`, `DefaultRandomSource` -> `SystemRng`)
 - #157980 (Some minor cleanups around hir ty/pat/expr)
 - #157988 (Fix incremental-finalize-fail proc macro test on AIX)
 - #157989 (run-make: handle AIX symbol cdylib export test)
 - #157998 (Add big disclaimer to the description of lint `explicit_outlives_requirements`)
@rust-bors rust-bors Bot merged commit 5096c1d into rust-lang:main Jun 17, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 17, 2026
rust-timer added a commit that referenced this pull request Jun 17, 2026
Rollup merge of #157539 - joshtriplett:random-source-rename, r=jhpratt

Rename `RandomSource` -> `Rng`, `DefaultRandomSource` -> `SystemRng`

Per naming bikeshed in libs-api. `Rng` is shorter, and already established in the ecosystem. `System` makes it self-documenting that `SystemRng` gets its randomness from the system RNG.

This also makes it short and convenient to write `SystemRng.fill_bytes`, rather than `DefaultRandomSource.fill_bytes`.
@joshtriplett joshtriplett deleted the random-source-rename branch June 23, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants