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 rand to 0.8 but use the SmallRng from 0.7 #8

Closed
wants to merge 1 commit into from

Conversation

terrorfisch
Copy link

@terrorfisch terrorfisch commented Oct 1, 2021

The SmallRng of rand changed from 0.7 to 0.8 on 64 bit machines. The new PRNG has a different seed size. This PR updates rand but keeps the old PNRG as the least invasive change.

Alternative:

Seed with an u64 as this is possible for all RNGs.

@@ -32,6 +32,11 @@ use std::{sync::Arc, time::Duration};
use rand::prelude::*;
use tracing::{debug, info, info_span};

#[cfg(all(not(target_os = "emscripten"), target_pointer_width = "64"))]
type SmallRng = rand_pcg::Pcg64Mcg;
#[cfg(not(all(not(target_os = "emscripten"), target_pointer_width = "64")))]
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure I follow why the #[cfg] is needed here — why not use the same one on all targets?

Copy link
Author

Choose a reason for hiding this comment

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

I just copied the code from rand 0.7

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, I see! I think I'd prefer to go the u64 path and stick with rand's SmallRng. Given that we'll probably end up with a breaking change from #7, I'm okay with breaking on this now.

@jonhoo
Copy link
Owner

jonhoo commented Sep 17, 2022

I've released bustle 0.5 with rand 0.8

@jonhoo jonhoo closed this Sep 17, 2022
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