Skip to content
Snippets Groups Projects
Commit a3a5f2e2 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

branch out RNG when measuring (dragoon/komodo!130)

- addresses #9 
- needed !133 to work

this MR simply adds `+ Clone` to `rng` and removes the `mut` from the `rng` of the `measure_inbreeding` function.

running the same snippet of code from #9 yields the following two images with a schedule of $1$ and $5$ respectively

![000_1.1](/uploads/ace74e299c6d4374df713ab5004f3c1d/000_1.1.png)
![000_1.2](/uploads/c784f5b62c41004971fd3048f7b5babc/000_1.2.png)

we see that all measurements on $t$ where $t = 0 \mod 5$ are the same in both images :tada:
parent 3b26bad1
No related branches found
No related tags found
No related merge requests found
......@@ -38,15 +38,17 @@ fn measure_inbreeding<F: PrimeField>(
nb_measurements: usize,
mp: &MultiProgress,
sty: &ProgressStyle,
rng: &mut impl RngCore,
rng: &(impl RngCore + Clone),
) -> f64 {
let mut rng = rng.clone();
let mut count = 0;
let pb = mp.add(ProgressBar::new(nb_measurements as u64));
pb.set_style(sty.clone());
pb.set_message("measure");
for _ in 0..nb_measurements {
if fec::decode(draw_unique_elements(shards, k, rng)).is_ok() {
if fec::decode(draw_unique_elements(shards, k, &mut rng)).is_ok() {
count += 1;
}
pb.inc(1);
......@@ -62,7 +64,7 @@ fn end_to_end<F, Fun>(
max_t: usize,
nb_measurements: usize,
measurement_schedule: Fun,
rng: &mut impl RngCore,
rng: &mut (impl RngCore + Clone),
) -> Result<(), KomodoError>
where
F: PrimeField,
......@@ -109,7 +111,7 @@ fn recoding<F, Fun>(
env: Environment,
nb_measurements: usize,
measurement_schedule: Fun,
rng: &mut impl RngCore,
rng: &mut (impl RngCore + Clone),
) -> Result<(), KomodoError>
where
F: PrimeField,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment