Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
target: aarch64-unknown-none
override: true

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
17 changes: 4 additions & 13 deletions src/rand_helper.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(feature = "std")]
use rand::RngCore;
use rand::{
distributions::{Distribution, Standard},
distr::{Distribution, StandardUniform},
prelude::StdRng,
Rng,
};
Expand All @@ -14,11 +14,11 @@ pub trait UniformRand: Sized {

impl<T> UniformRand for T
where
Standard: Distribution<T>,
StandardUniform: Distribution<T>,
{
#[inline]
fn rand<R: Rng + ?Sized>(rng: &mut R) -> Self {
rng.sample(Standard)
rng.sample(StandardUniform)
}
}

Expand Down Expand Up @@ -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)))]
Expand Down Expand Up @@ -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"))]
Expand Down