From e678435cab9cc8ddd668d4cb58ab82194c220382 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Wed, 9 Oct 2013 17:39:37 +1100 Subject: std::rand: Minor clean-up of comments & add a missing default method. --- src/libstd/rand/mod.rs | 7 +++++-- src/libstd/rt/sched.rs | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index aa4b496338d..9b757092266 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -648,8 +648,6 @@ impl SeedableRng<[u32, .. 4]> for XorShiftRng { impl XorShiftRng { /// Create an xor shift random number generator with a random seed. pub fn new() -> XorShiftRng { - // generate seeds the same way as seed(), except we have a - // specific size, so we can just use a fixed buffer. let mut s = [0u8, ..16]; loop { let mut r = OSRng::new(); @@ -714,6 +712,11 @@ impl Rng for @mut R { fn next_u64(&mut self) -> u64 { (**self).next_u64() } + + #[inline] + fn fill_bytes(&mut self, bytes: &mut [u8]) { + (**self).fill_bytes(bytes); + } } /// Generate a random value using the task-local random number diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index e5cbadda23d..ee43ced44ab 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -863,7 +863,6 @@ fn new_sched_rng() -> XorShiftRng { use iter::Iterator; use rand::SeedableRng; - // XXX: this could use io::native::file, when it works. let fd = do "/dev/urandom".with_c_str |name| { unsafe { libc::open(name, libc::O_RDONLY, 0) } }; -- cgit 1.4.1-3-g733a5