Skip to content

Commit

Permalink
Generate weak_rng from thread_rng. Fixes #180.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpeterso committed Oct 24, 2017
1 parent 0ad6d53 commit b008e1d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,13 +892,9 @@ impl<'a> SeedableRng<&'a [usize]> for StdRng {
/// seeded `Rng` for consistency over time you should pick one algorithm and
/// create the `Rng` yourself.
///
/// This will read randomness from the operating system to seed the
/// generator.
/// This will seed the generator with randomness from thread_rng.
pub fn weak_rng() -> XorShiftRng {
match OsRng::new() {
Ok(mut r) => r.gen(),
Err(e) => panic!("weak_rng: failed to create seeded RNG: {:?}", e)
}
thread_rng().gen()
}

/// Controls how the thread-local RNG is reseeded.
Expand Down

0 comments on commit b008e1d

Please sign in to comment.