about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-10-23 08:31:21 -0700
committerbors <bors@rust-lang.org>2013-10-23 08:31:21 -0700
commita4ec8af4c549bd806522826b756e18fbf0b5c47b (patch)
tree94b419a959409c8616e95645aefe4f73cd619294 /src/libstd/rt
parent5de50a3f7135329d862c9265f5749ab7de865873 (diff)
parent0bba73c0d156df8f22c64ef4f4c50910fe31cf31 (diff)
downloadrust-a4ec8af4c549bd806522826b756e18fbf0b5c47b.tar.gz
rust-a4ec8af4c549bd806522826b756e18fbf0b5c47b.zip
auto merge of #9810 : huonw/rust/rand3, r=alexcrichton
- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference).
- Adds proper `Normal` and `Exp`-onential distributions
- Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself)
- Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it
- optimisations and docs
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/comm.rs2
-rw-r--r--src/libstd/rt/sched.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs
index 0d4271a33c2..6319fdead17 100644
--- a/src/libstd/rt/comm.rs
+++ b/src/libstd/rt/comm.rs
@@ -1117,7 +1117,7 @@ mod test {
             let total = stress_factor() + 10;
             let mut rng = rand::rng();
             do total.times {
-                let msgs = rng.gen_integer_range(0u, 10);
+                let msgs = rng.gen_range(0u, 10);
                 let pipe_clone = pipe.clone();
                 let end_chan_clone = end_chan.clone();
                 do spawntask_random {
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs
index 48cd7987507..ee163bab3c0 100644
--- a/src/libstd/rt/sched.rs
+++ b/src/libstd/rt/sched.rs
@@ -431,7 +431,7 @@ impl Scheduler {
     fn try_steals(&mut self) -> Option<~Task> {
         let work_queues = &mut self.work_queues;
         let len = work_queues.len();
-        let start_index = self.rng.gen_integer_range(0, len);
+        let start_index = self.rng.gen_range(0, len);
         for index in range(0, len).map(|i| (i + start_index) % len) {
             match work_queues[index].steal() {
                 Some(task) => {