diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-25 16:13:11 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-04-01 20:46:10 +1100 |
| commit | bc7a2d72a3fea324fa432de9b6ce6073302d3d8c (patch) | |
| tree | 5291b4abea25c42302facd2cf2387003060ae376 /src/libcollections | |
| parent | 0e8c949786539375ccb6ebe4af968c7cf5cebe43 (diff) | |
| download | rust-bc7a2d72a3fea324fa432de9b6ce6073302d3d8c.tar.gz rust-bc7a2d72a3fea324fa432de9b6ce6073302d3d8c.zip | |
rand: bubble up IO messages futher.
The various ...Rng::new() methods can hit IO errors from the OSRng they use, and it seems sensible to expose them at a higher level. Unfortunately, writing e.g. `StdRng::new().unwrap()` gives a much poorer error message than if it failed internally, but this is a problem with all `IoResult`s.
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/deque.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcollections/deque.rs b/src/libcollections/deque.rs index 05df04d293f..6fd525bac2e 100644 --- a/src/libcollections/deque.rs +++ b/src/libcollections/deque.rs @@ -52,7 +52,7 @@ pub mod bench { map: &mut M, bh: &mut BenchHarness) { // setup - let mut rng = rand::XorShiftRng::new(); + let mut rng = rand::weak_rng(); map.clear(); for _ in range(0, n) { @@ -89,7 +89,7 @@ pub mod bench { map: &mut M, bh: &mut BenchHarness) { // setup - let mut rng = rand::XorShiftRng::new(); + let mut rng = rand::weak_rng(); let mut keys = slice::from_fn(n, |_| rng.gen::<uint>() % n); for k in keys.iter() { |
