inclusion-prob: make rng generic and predictable in tests (#1561)

This commit is contained in:
Jon Häggblad
2022-08-25 08:47:04 +02:00
committed by GitHub
parent 0c3c13ae88
commit e1e20fb13e
2 changed files with 34 additions and 9 deletions
@@ -200,12 +200,14 @@ fn compute_inclusion_probabilities(
let (ids, mixnode_total_bonds) = unzip_into_mixnode_ids_and_total_bonds(mixnode_bonds);
// Compute inclusion probabilitites and keep track of how long time it took.
let mut rng = rand::thread_rng();
let results = inclusion_probability::simulate_selection_probability_mixnodes(
&mixnode_total_bonds,
active_set_size,
standby_set_size,
MAX_SIMULATION_SAMPLES,
Duration::from_secs(MAX_SIMULATION_TIME_SEC),
&mut rng,
)
.tap_err(|err| error!("{err}"))
.ok()?;