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

Remove SmallRng::from_thread_rng #1532

Merged
merged 8 commits into from
Nov 22, 2024
Merged

Conversation

dhardy
Copy link
Member

@dhardy dhardy commented Nov 20, 2024

  • Added a CHANGELOG.md entry

Summary

Title

Motivation

See #1531

@dhardy dhardy requested review from vks and newpavlov November 20, 2024 11:50
/// ```
/// # use rand::{SeedableRng, rngs::SmallRng};
/// let rng = SmallRng::from_os_rng();
/// let rng = SmallRng::seed_from_u64(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep the mention of from_os_rng.

@@ -27,7 +27,7 @@ where
{
g.throughput(criterion::Throughput::Bytes(size_of::<T>() as u64));
g.bench_function(name, |b| {
let mut rng = Pcg64Mcg::from_os_rng();
let mut rng = Pcg64Mcg::from_rng(&mut rand::rng());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of from_os_rng should not influence the benchmark results since only time for the closure passed to iter is measured.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. It may improve set-up time slightly; at any rate I see no harm in using rand::rng().

@dhardy dhardy merged commit c68463c into rust-random:master Nov 22, 2024
16 checks passed
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