Skip to content

Commit

Permalink
std::rand: Minor clean-up of comments & add a missing default method.
Browse files Browse the repository at this point in the history
  • Loading branch information
huonw committed Oct 9, 2013
1 parent 5442a47 commit e678435
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/libstd/rand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -714,6 +712,11 @@ impl<R: Rng> 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
Expand Down
1 change: 0 additions & 1 deletion src/libstd/rt/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
};
Expand Down

5 comments on commit e678435

@bors
Copy link
Contributor

@bors bors commented on e678435 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at huonw@e678435

@bors
Copy link
Contributor

@bors bors commented on e678435 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging huonw/rust/rand2 = e678435 into auto

@bors
Copy link
Contributor

@bors bors commented on e678435 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huonw/rust/rand2 = e678435 merged ok, testing candidate = f647ccc

@bors
Copy link
Contributor

@bors bors commented on e678435 Oct 9, 2013

@bors
Copy link
Contributor

@bors bors commented on e678435 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = f647ccc

Please sign in to comment.