2015-03-10 23:58:16 -05:00
|
|
|
mod map;
|
|
|
|
mod set;
|
2016-05-29 05:30:13 -05:00
|
|
|
|
|
|
|
/// XorShiftRng
|
|
|
|
struct DeterministicRng {
|
|
|
|
x: u32,
|
|
|
|
y: u32,
|
|
|
|
z: u32,
|
|
|
|
w: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DeterministicRng {
|
|
|
|
fn new() -> Self {
|
2019-11-29 21:30:49 -06:00
|
|
|
DeterministicRng { x: 0x193a6754, y: 0xa8a7d469, z: 0x97830e05, w: 0x113ba7bb }
|
2016-05-29 05:30:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn next(&mut self) -> u32 {
|
|
|
|
let x = self.x;
|
|
|
|
let t = x ^ (x << 11);
|
|
|
|
self.x = self.y;
|
|
|
|
self.y = self.z;
|
|
|
|
self.z = self.w;
|
|
|
|
let w_ = self.w;
|
|
|
|
self.w = w_ ^ (w_ >> 19) ^ (t ^ (t >> 8));
|
|
|
|
self.w
|
|
|
|
}
|
|
|
|
}
|