From 14ce3914cf6b9853433ba5425aee7a284cedddd8 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 10 May 2024 16:12:05 +0300 Subject: [PATCH] fix: init rng outside of the loop --- mpz-core/src/lpn.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpz-core/src/lpn.rs b/mpz-core/src/lpn.rs index cd99ca3d..2543fdb2 100644 --- a/mpz-core/src/lpn.rs +++ b/mpz-core/src/lpn.rs @@ -145,9 +145,10 @@ impl LpnParameters { assert_eq!(self.n % self.t, 0); let one: Block = bytemuck::cast(1_u128); let mut res = vec![Block::ZERO; self.n]; + let mut rng = thread_rng(); + res.chunks_exact_mut(self.n / self.t).for_each(|x| { x[0] = one; - let mut rng = thread_rng(); x.shuffle(&mut rng); }); res