Skip to content

Commit d916606

Browse files
xtqqczzecakebaker
authored andcommitted
docs(sort): fix random number generation
1 parent 1f6512d commit d916606

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/uu/sort/BENCHMARKING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Run `cargo build --release` before benchmarking after you make a change!
5151

5252
```toml
5353
[dependencies]
54-
rand = "0.8.3"
54+
rand = "0.10.0"
5555
```
5656

5757
## main.rs
@@ -60,12 +60,12 @@ rand = "0.8.3"
6060
use rand::prelude::*;
6161
fn main() {
6262
let suffixes = ['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y', 'R', 'Q'];
63-
let mut rng = thread_rng();
63+
let mut rng = rand::rng();
6464
for _ in 0..100000 {
6565
println!(
6666
"{}{}",
67-
rng.gen_range(0..1000000),
68-
suffixes.choose(&mut rng).unwrap()
67+
rng.random_range(0..1000000),
68+
suffixes[rng.random_range(..suffixes.len())],
6969
)
7070
}
7171
}

0 commit comments

Comments
 (0)