From a836f13dc0c2c636fd00b77d05f50a00cc3a7c55 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Wed, 9 Oct 2013 01:54:21 +1100 Subject: [PATCH] Documentation & address minor point. --- src/libstd/rand/mod.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index b07d00f2236a..1465e5942274 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -535,8 +535,9 @@ pub trait SeedableRng: Rng { /// /// This is a very expensive operation as it has to read randomness /// from the operating system and use this in an expensive seeding -/// operation. If one does not require high performance, `task_rng` -/// and/or `random` may be more appropriate. +/// operation. If one does not require high performance generation of +/// random numbers, `task_rng` and/or `random` may be more +/// appropriate. pub fn rng() -> StdRng { StdRng::new() } @@ -596,6 +597,9 @@ impl<'self> SeedableRng<&'self [uint]> for StdRng { /// 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. +/// +/// This will read randomness from the operating system to seed the +/// generator. pub fn weak_rng() -> XorShiftRng { XorShiftRng::new() } @@ -667,8 +671,8 @@ impl XorShiftRng { break; } } - let s: &[u32, ..4] = unsafe { cast::transmute(&s) }; - SeedableRng::from_seed(*s) + let s: [u32, ..4] = unsafe { cast::transmute(s) }; + SeedableRng::from_seed(s) } }