make useful stuff public
authoralfadur
Mon, 29 Oct 2018 23:29:03 +0300
changeset 14048 cef0c685fda8
parent 14047 3b3d97ed2286
child 14049 0f517cbfe16d
make useful stuff public
rust/landgen/src/lib.rs
rust/lfprng/src/lib.rs
--- a/rust/landgen/src/lib.rs	Sun Oct 28 23:24:04 2018 +0100
+++ b/rust/landgen/src/lib.rs	Mon Oct 29 23:29:03 2018 +0300
@@ -3,12 +3,12 @@
 extern crate integral_geometry;
 extern crate land2d;
 
-struct LandGenerationParameters<T> {
+pub struct LandGenerationParameters<T> {
     zero: T,
     basic: T,
 }
 
-trait LandGenerator {
+pub trait LandGenerator {
     fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>(
         &self,
         parameters: LandGenerationParameters<T>,
--- a/rust/lfprng/src/lib.rs	Sun Oct 28 23:24:04 2018 +0100
+++ b/rust/lfprng/src/lib.rs	Mon Oct 29 23:29:03 2018 +0300
@@ -4,7 +4,7 @@
 }
 
 impl LaggedFibonacciPRNG {
-    fn new(init_values: &[u8]) -> Self {
+    pub fn new(init_values: &[u8]) -> Self {
         let mut buf = [0xa98765 + 68; 64];
 
         for i in 0..std::cmp::min(init_values.len(), 54) {
@@ -24,7 +24,7 @@
     }
 
     #[inline]
-    fn get_next(&mut self) -> u32 {
+    pub fn get_next(&mut self) -> u32 {
         self.index = (self.index + 1) & 0x3f;
         self.circular_buffer[self.index] = (self.circular_buffer[(self.index + 40) & 0x3f]
             + self.circular_buffer[(self.index + 9) & 0x3f])
@@ -34,13 +34,13 @@
     }
 
     #[inline]
-    fn get_random(&mut self, modulo: u32) -> u32 {
+    pub fn get_random(&mut self, modulo: u32) -> u32 {
         self.get_next();
         self.get_next() % modulo
     }
 
     #[inline]
-    fn add_randomness(&mut self, value: u32) {
+    pub fn add_randomness(&mut self, value: u32) {
         self.index = (self.index + 1) & 0x3f;
         self.circular_buffer[self.index] ^= value;
     }