Update to rand 0.8

Part of general crate updates.
This commit is contained in:
Colin Walters 2022-03-11 15:34:59 -05:00
parent fba7efb6da
commit 75ae283f23
4 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ tokio = { version = "1.4.0", features = ["full"] }
futures-util = "0.3.1" futures-util = "0.3.1"
base64 = "0.12.0" base64 = "0.12.0"
procspawn = "0.8" procspawn = "0.8"
rand = "0.7.3" rand = "0.8"
strum = "0.18.0" strum = "0.18.0"
strum_macros = "0.18.0" strum_macros = "0.18.0"
openat = "0.1.19" openat = "0.1.19"

View File

@ -450,7 +450,7 @@ fn impl_transaction_test<M: AsRef<str>>(
let ms = std::cmp::min(cycle_time_ms.saturating_mul(20), 24 * 60 * 60 * 1000); let ms = std::cmp::min(cycle_time_ms.saturating_mul(20), 24 * 60 * 60 * 1000);
time::Duration::from_millis(ms) time::Duration::from_millis(ms)
} else { } else {
time::Duration::from_millis(rng.gen_range(0, cycle_time_ms)) time::Duration::from_millis(rng.gen_range(0..cycle_time_ms))
}; };
println!( println!(
"force-reboot-time={:?} cycle={:?} status:{:?}", "force-reboot-time={:?} cycle={:?} status:{:?}",

View File

@ -91,7 +91,7 @@ pub(crate) async fn http_server<P: AsRef<Path>>(
) -> Result<Response<Body>> { ) -> Result<Response<Body>> {
if let Some(random_delay) = opts.random_delay { if let Some(random_delay) = opts.random_delay {
let slices = 100u32; let slices = 100u32;
let n: u32 = rand::thread_rng().gen_range(0, slices); let n: u32 = rand::thread_rng().gen_range(0..slices);
std::thread::sleep((random_delay / slices) * n); std::thread::sleep((random_delay / slices) * n);
} }
if opts.basicauth { if opts.basicauth {

View File

@ -62,9 +62,9 @@ pub(crate) fn mutate_one_executable_to(
let extra = rand::thread_rng() let extra = rand::thread_rng()
.sample_iter(&rand::distributions::Alphanumeric) .sample_iter(&rand::distributions::Alphanumeric)
.take(10) .take(10)
.collect::<String>(); .collect::<Vec<u8>>();
destf destf
.write_all(extra.as_bytes()) .write_all(&extra)
.context("Failed to append extra data")?; .context("Failed to append extra data")?;
Ok(()) Ok(())
} }