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:
commit
c7fc0a703b
18 changed files with 223 additions and 155 deletions
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue