diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ac6b98..6c39bcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: toolchain: ${{ matrix.rust }} override: true - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -106,7 +106,7 @@ jobs: target: aarch64-unknown-none override: true - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: | ~/.cargo/registry diff --git a/Cargo.toml b/Cargo.toml index 78f59df..510b8b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,13 @@ license = "MIT/Apache-2.0" edition = "2021" [dependencies] -rand = { version = "0.8", default-features = false, features = ["std_rng"]} +rand = { version = "0.9", default-features = false, features = ["std_rng"]} rayon = { version = "1", optional = true } colored = { version = "2", optional = true } num-traits = { version = "0.2", default-features = false } [dev-dependencies] -rand = { version = "0.8", features = ["std"]} +rand = { version = "0.9", features = ["std"]} [features] diff --git a/src/rand_helper.rs b/src/rand_helper.rs index 6af19c5..b56c499 100644 --- a/src/rand_helper.rs +++ b/src/rand_helper.rs @@ -1,7 +1,7 @@ #[cfg(feature = "std")] use rand::RngCore; use rand::{ - distributions::{Distribution, Standard}, + distr::{Distribution, StandardUniform}, prelude::StdRng, Rng, }; @@ -14,11 +14,11 @@ pub trait UniformRand: Sized { impl UniformRand for T where - Standard: Distribution, + StandardUniform: Distribution, { #[inline] fn rand(rng: &mut R) -> Self { - rng.sample(Standard) + rng.sample(StandardUniform) } } @@ -48,7 +48,7 @@ pub fn test_rng() -> impl rand::Rng { if is_deterministic { RngWrapper::Deterministic(test_rng_helper()) } else { - RngWrapper::Randomized(rand::thread_rng()) + RngWrapper::Randomized(rand::rng()) } } #[cfg(not(any(feature = "getrandom", test)))] @@ -93,15 +93,6 @@ impl RngCore for RngWrapper { Self::Randomized(rng) => rng.fill_bytes(dest), } } - - #[inline(always)] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { - match self { - Self::Deterministic(rng) => rng.try_fill_bytes(dest), - #[cfg(any(feature = "getrandom", test))] - Self::Randomized(rng) => rng.try_fill_bytes(dest), - } - } } #[cfg(all(test, feature = "std"))]