# HG changeset patch # User alfadur # Date 1559676508 -10800 # Node ID 7c4d6246a531f57bb1d6a64d360c0973385769ca # Parent cce6e707172f216f704118982bdc056c186e59f6# Parent de32299de7049c76e8216aac17b83198682726d2 merge diff -r cce6e707172f -r 7c4d6246a531 rust/lfprng/src/lib.rs --- a/rust/lfprng/src/lib.rs Tue Jun 04 22:25:28 2019 +0300 +++ b/rust/lfprng/src/lib.rs Tue Jun 04 22:28:28 2019 +0300 @@ -16,14 +16,19 @@ index: 54, }; - for _i in 0..2048 { - prng.get_next(); - } + prng.discard(2048); prng } #[inline] + pub fn discard(&mut self, count: usize) { + for _i in 0..count { + self.get_next(); + } + } + + #[inline] fn get_next(&mut self) -> u32 { self.index = (self.index + 1) & 0x3f; self.circular_buffer[self.index] = (self.circular_buffer[(self.index + 40) & 0x3f]