about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-09-30 01:29:28 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2013-10-09 22:22:42 +1100
commit92725ae765a75b139d5d5fc27305f4436dbb456e (patch)
tree168c40b54768a00a27960a32c8d2d0478947acca /src/libstd/rt
parent0223cf65e41cc1046b306dcd0e3959a20729e0cf (diff)
downloadrust-92725ae765a75b139d5d5fc27305f4436dbb456e.tar.gz
rust-92725ae765a75b139d5d5fc27305f4436dbb456e.zip
std::rand: Add a trait for seeding RNGs: SeedableRng.
This provides 2 methods: .reseed() and ::from_seed that modify and
create respecitively.

Implement this trait for the RNGs in the stdlib for which this makes
sense.
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/sched.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs
index 004dab8d73a..c1ca484754d 100644
--- a/src/libstd/rt/sched.rs
+++ b/src/libstd/rt/sched.rs
@@ -26,7 +26,7 @@ use rt::local::Local;
 use rt::rtio::{RemoteCallback, PausibleIdleCallback};
 use borrow::{to_uint};
 use cell::Cell;
-use rand::{XorShiftRng, Rng, Rand};
+use rand::{SeedableRng, XorShiftRng, Rng, Rand};
 use iter::range;
 use vec::{OwnedVector};
 
@@ -895,7 +895,7 @@ fn new_sched_rng() -> XorShiftRng {
     // know that the only way that we can fail here is `abort`ing?
     unsafe {libc::fclose(file);}
 
-    XorShiftRng::new_seeded(seeds[0], seeds[1], seeds[2], seeds[3])
+    SeedableRng::from_seed(seeds)
 }
 
 #[cfg(test)]