Use getrandom instead of rand for benches
The current code didn’t build, and this one includes fewer dependencies than the full rand set of crates.
This commit is contained in:
parent
7edf2489d5
commit
b031ab75bd
2 changed files with 3 additions and 3 deletions
|
@ -20,7 +20,7 @@ thiserror = "1.0"
|
|||
|
||||
[dev-dependencies]
|
||||
bencher = "0.1"
|
||||
rand = "0.7"
|
||||
getrandom = "0.2"
|
||||
walkdir = "2"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -3,7 +3,7 @@ use bencher::{benchmark_group, benchmark_main};
|
|||
use std::io::{Cursor, Read, Write};
|
||||
|
||||
use bencher::Bencher;
|
||||
use rand::Rng;
|
||||
use getrandom::getrandom;
|
||||
use zip::{ZipArchive, ZipWriter};
|
||||
|
||||
fn generate_random_archive(size: usize) -> Vec<u8> {
|
||||
|
@ -14,7 +14,7 @@ fn generate_random_archive(size: usize) -> Vec<u8> {
|
|||
|
||||
writer.start_file("random.dat", options).unwrap();
|
||||
let mut bytes = vec![0u8; size];
|
||||
rand::thread_rng().fill_bytes(&mut bytes);
|
||||
getrandom(&mut bytes).unwrap();
|
||||
writer.write_all(&bytes).unwrap();
|
||||
|
||||
writer.finish().unwrap().into_inner()
|
||||
|
|
Loading…
Add table
Reference in a new issue