Skip to content

Commit 8ceba5d

Browse files
committed
SmallRng: do not expect thread_rng
1 parent 87f1f5b commit 8ceba5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rngs/small.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//! A small fast RNG
1010
1111
use rand_core::{Error, RngCore, SeedableRng};
12-
use crate::thread_rng;
1312

1413
#[cfg(target_pointer_width = "64")]
1514
type Rng = super::xoshiro256plusplus::Xoshiro256PlusPlus;
@@ -82,9 +81,10 @@ impl SmallRng {
8281
}
8382

8483
/// Construct an instance seeded from the thread-local RNG
84+
#[cfg(all(feature = "std", feature = "std_rng", feature = "getrandom"))]
8585
#[inline(always)]
8686
pub fn from_thread_rng() -> Result<Self, Error> {
87-
Rng::from_rng(thread_rng()).map(SmallRng)
87+
Rng::from_rng(crate::thread_rng()).map(SmallRng)
8888
}
8989

9090
/// Construct an instance from a `u64` seed

0 commit comments

Comments
 (0)