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

Update to rand master #53

Merged
merged 9 commits into from
Jun 4, 2024
Merged

Update to rand master #53

merged 9 commits into from
Jun 4, 2024

Conversation

dhardy
Copy link
Member

@dhardy dhardy commented May 25, 2024

Temporarily, we patch this repo to use rand from git. Not ideal, but:

  • It lets us get this code (mostly) ready for the next rand version now
  • Lets us test the rand_core changes
  • Allows us to move rand_pcg here, if we want to (possibly not; it is used by benches in the rand repo)

Comment on lines 102 to 110
#[inline]
fn from_rng<R: RngCore>(rng: R) -> Result<Self, Error> {
BlockRng::<Hc128Core>::from_rng(rng).map(Hc128Rng)
fn from_rng(rng: impl RngCore) -> Self {
Hc128Rng(BlockRng::<Hc128Core>::from_rng(rng))
}

#[inline]
fn try_from_rng<R: TryRngCore>(rng: R) -> Result<Self, R::Error> {
BlockRng::<Hc128Core>::try_from_rng(rng).map(Hc128Rng)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

In many cases, I think we need to implement both of these. Annoying, but not terrible.

Copy link
Member

Choose a reason for hiding this comment

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

As I suggested some time ago, in the new release cycle it may be worth to drop the block stuff completely. I will try to do a draft PR later.

Comment on lines +770 to +773
impl<F> rand_core::TryRngCore for JitterRng<F>
where
F: Fn() -> u64 + Send + Sync,
{
Copy link
Member Author

Choose a reason for hiding this comment

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

We can't use impl_try_rng_from_rng_core here. Ideally it would support types with generics, but probably not worth bothering.

The test fails with CoarseTimer on one test target, showing
that test_timer does something useful.
@dhardy dhardy requested a review from newpavlov June 4, 2024 08:20
@dhardy dhardy merged commit 83061f6 into rust-random:master Jun 4, 2024
13 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