Skip to content

Commit

Permalink
Use seed from time
Browse files Browse the repository at this point in the history
  • Loading branch information
triarius committed Jul 6, 2024
1 parent 6a4c322 commit 0ec799d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/passphrase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ mod test {

let batches = std::thread::available_parallelism().unwrap();
let words = words::list(Some("src/fixtures/test")).unwrap();
let seed = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs();

eprintln!("Available parallelism: {batches}");
eprintln!("Number of samples: {N}");
eprintln!("Seed: {seed}");

let histogram = (0..N)
.collect::<Vec<_>>()
.par_iter()
.fold_chunks(N / batches, HashMap::new, |mut acc, i| {
let seed = *i as u64;
let mut rng = ChaCha8Rng::seed_from_u64(seed);
rng.set_stream(*i as u64);
let mut words = words.clone();
Expand Down

0 comments on commit 0ec799d

Please sign in to comment.