pseudorandom 0.0.3

Algorithms for *pseudorandom* values
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub struct Mulberry32 {
    pub seed: u32,
}

impl Mulberry32 {
    pub fn next_value(&mut self) -> u32 {
        self.seed = self.seed.wrapping_add(0x6D2B79F5);
        let mut t = self.seed;
        t = (t ^ t.wrapping_shr(15)).wrapping_mul(t | 1);
        t ^= t.wrapping_add(t ^ t.wrapping_shr(7).wrapping_mul(t | 61));
        t ^ t.wrapping_shr(14)
    }
}