1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #2893 from g-k/2888-rand-0.8

update rand crate to 0.8
This commit is contained in:
Sylvestre Ledru 2022-01-25 23:23:43 +01:00 committed by GitHub
commit c7fc0a703b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 223 additions and 155 deletions

View file

@ -13,7 +13,7 @@ uu_factor = { path = "../../../src/uu/factor" }
[dev-dependencies]
array-init = "2.0.0"
criterion = "0.3"
rand = "0.7"
rand = "0.8"
rand_chacha = "0.2.2"

View file

@ -115,7 +115,7 @@ fn test_random() {
// log distribution---higher probability for lower numbers
let factor;
loop {
let next = rng.gen_range(0_f64, log_num_primes).exp2().floor() as usize;
let next = rng.gen_range(0_f64..log_num_primes).exp2().floor() as usize;
if next < NUM_PRIMES {
factor = primes[next];
break;

View file

@ -22,6 +22,7 @@ use std::{
fn random_chars(n: usize) -> String {
thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
.map(char::from)
.take(n)
.collect::<String>()
}