merge
authoralfadur
Tue, 04 Jun 2019 22:28:28 +0300
changeset 15138 7c4d6246a531
parent 15137 cce6e707172f (current diff)
parent 15136 de32299de704 (diff)
child 15139 0e59abde6766
merge
--- 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]