Skip to content

Commit 807b142

Browse files
committed
Generate weak_rng from thread_rng
1 parent a8c833e commit 807b142

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -891,13 +891,9 @@ impl<'a> SeedableRng<&'a [usize]> for StdRng {
891891
/// seeded `Rng` for consistency over time you should pick one algorithm and
892892
/// create the `Rng` yourself.
893893
///
894-
/// This will read randomness from the operating system to seed the
895-
/// generator.
894+
/// This will seed the generator with randomness from thread_rng.
896895
pub fn weak_rng() -> XorShiftRng {
897-
match OsRng::new() {
898-
Ok(mut r) => r.gen(),
899-
Err(e) => panic!("weak_rng: failed to create seeded RNG: {:?}", e)
900-
}
896+
thread_rng().gen()
901897
}
902898

903899
/// Controls how the thread-local RNG is reseeded.

0 commit comments

Comments
 (0)