Skip to content

Commit e73e3a2

Browse files
committed
rand_core only
1 parent e5e440e commit e73e3a2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ num-integer = "0.1"
2323
num-traits = "0.2"
2424
ndarray = ">= 0.15, < 0.17"
2525
pyo3 = { version = "0.25.0", default-features = false, features = ["macros"] }
26-
rand = { version = "0.9.1", default-features = false, optional = true }
26+
rand_core = { version = "0.9.3", default-features = false, optional = true }
2727
rustc-hash = "2.0"
2828

2929
[dev-dependencies]
@@ -33,6 +33,7 @@ pyo3 = { version = "0.25", default-features = false, features = [
3333
nalgebra = { version = ">=0.30, <0.34", default-features = false, features = [
3434
"std",
3535
] }
36+
rand = { version = "0.9.1", default-features = false }
3637

3738
[build-dependencies]
3839
pyo3-build-config = { version = "0.25", features = ["resolve-config"] }

src/random.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,16 @@ impl<'py> PyBitGeneratorGuard {
191191
}
192192
}
193193

194-
#[cfg(feature = "rand")]
195-
impl rand::RngCore for PyBitGeneratorGuard {
194+
#[cfg(feature = "rand_core")]
195+
impl rand_core::RngCore for PyBitGeneratorGuard {
196196
fn next_u32(&mut self) -> u32 {
197197
PyBitGeneratorGuard::next_u32(self)
198198
}
199199
fn next_u64(&mut self) -> u64 {
200200
PyBitGeneratorGuard::next_u64(self)
201201
}
202202
fn fill_bytes(&mut self, dst: &mut [u8]) {
203-
rand::rand_core::impls::fill_bytes_via_next(self, dst)
203+
rand_core::impls::fill_bytes_via_next(self, dst)
204204
}
205205
}
206206

@@ -230,7 +230,6 @@ mod tests {
230230
}
231231

232232
/// More complex version of primary use case: use from multiple threads
233-
#[cfg(feature = "rand")]
234233
#[test]
235234
fn use_parallel() -> PyResult<()> {
236235
use crate::array::{PyArray2, PyArrayMethods as _};
@@ -264,7 +263,6 @@ mod tests {
264263
}
265264

266265
/// Test that the `rand::Rng` APIs work
267-
#[cfg(feature = "rand")]
268266
#[test]
269267
fn rand() -> PyResult<()> {
270268
use rand::Rng as _;

0 commit comments

Comments
 (0)