Skip to content

Commit

Permalink
Add weak_rng to get a random algo that puts more emphasis on speed th…
Browse files Browse the repository at this point in the history
…an security
  • Loading branch information
Seldaek authored and emberian committed Aug 8, 2013
1 parent 3db9dc1 commit 403c52d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/rand.rs
Expand Up @@ -619,6 +619,16 @@ pub fn rng() -> IsaacRng {
IsaacRng::new()
}

/// Create a weak random number generator with a default algorithm and seed.
///
/// It returns the fatest `Rng` algorithm currently available in Rust without
/// consideration for cryptography or security. If you require a specifically
/// seeded `Rng` for consistency over time you should pick one algorithm and
/// create the `Rng` yourself.
pub fn weak_rng() -> XorShiftRng {
XorShiftRng::new()
}

static RAND_SIZE_LEN: u32 = 8;
static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN;

Expand Down

0 comments on commit 403c52d

Please sign in to comment.