Skip to content

Commit

Permalink
chore: update to latest rand beta version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluefinger committed Nov 26, 2024
1 parent a0d6757 commit 067ae9e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ legacy_v4 = []

[dependencies]
getrandom = { version = "0.2", optional = true }
rand = { version = "=0.9.0-alpha.2", optional = true }
rand_core = { version = "=0.9.0-alpha.2", default-features = false, optional = true }
rand = { version = "=0.9.0-beta.0", optional = true }
rand_core = { version = "=0.9.0-beta.0", default-features = false, optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }

[dev-dependencies]
criterion = "0.5"
serde_test = "1.0"
rand = "=0.9.0-alpha.2"
rand = "=0.9.0-beta.0"

[[bench]]
name = "rand_bench"
Expand Down
4 changes: 2 additions & 2 deletions benches/rand_bench.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use criterion::{black_box, criterion_main, Criterion};

fn wyrand_benchmark(c: &mut Criterion) {
use rand::thread_rng;
use rand::rng;
use rand_core::{RngCore, SeedableRng};
use wyrand::WyRand;

Expand Down Expand Up @@ -32,7 +32,7 @@ fn wyrand_benchmark(c: &mut Criterion) {
});

c.bench_function("from_rng", |b| {
b.iter(|| black_box(WyRand::from_rng(thread_rng())))
b.iter(|| black_box(WyRand::from_rng(&mut rng())))
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/final_v4_2/wyrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ impl SeedableRng for WyRand {
}

#[inline]
fn from_rng(mut rng: impl RngCore) -> Self {
fn from_rng(rng: &mut impl RngCore) -> Self {
Self::new(rng.next_u64())
}

#[inline]
fn try_from_rng<R: TryRngCore>(mut rng: R) -> Result<Self, R::Error> {
fn try_from_rng<R: TryRngCore>(rng: &mut R) -> Result<Self, R::Error> {
Ok(Self::new(rng.try_next_u64()?))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/legacy_final_v4/wyrand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ impl SeedableRng for WyRandLegacy {
}

#[inline]
fn from_rng(mut rng: impl RngCore) -> Self {
fn from_rng(rng: &mut impl RngCore) -> Self {
Self::new(rng.next_u64())
}

#[inline]
fn try_from_rng<R: TryRngCore>(mut rng: R) -> Result<Self, R::Error> {
fn try_from_rng<R: TryRngCore>(rng: &mut R) -> Result<Self, R::Error> {
Ok(Self::new(rng.try_next_u64()?))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ pub(crate) fn get_random_u64() -> u64 {
use rand_core::RngCore;

// This is faster than doing `.fill_bytes()`. User-space entropy goes brrr.
rand::thread_rng().next_u64()
rand::rng().next_u64()
}
}

0 comments on commit 067ae9e

Please sign in to comment.