sim: Upgrade to 0.7 API version of rand
There have been some revamping of the Rand API. The Standard
distribution on floating point numbers will return a value in the
interval [0,1).
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/simflash/src/lib.rs b/sim/simflash/src/lib.rs
index c991d47..734b3c1 100644
--- a/sim/simflash/src/lib.rs
+++ b/sim/simflash/src/lib.rs
@@ -15,7 +15,8 @@
use log::info;
use rand::{
self,
- distributions::{IndependentSample, Range},
+ distributions::Standard,
+ Rng,
};
use std::{
collections::HashMap,
@@ -188,8 +189,8 @@
for &(off, len, rate) in &self.bad_region {
if offset >= off && (offset + payload.len()) <= (off + len) {
let mut rng = rand::thread_rng();
- let between = Range::new(0., 1.);
- if between.ind_sample(&mut rng) < rate {
+ let samp: f32 = rng.sample(Standard);
+ if samp < rate {
bail!(esimulatedwrite(
format!("Ignoring write to {:#x}-{:#x}", off, off + len)));
}