v2 / vlib / rand / wyrand / wyrand.js.v
16 lines · 13 sloc · 257 bytes · f21cce4b6929222724c3b1097242850c58712620
Raw
1module wyrand
2
3import hash
4
5pub fn (mut r WyRandRNG) free() {}
6
7@[ignore_overflow; inline]
8pub fn (mut rng WyRandRNG) u64() u64 {
9 unsafe {
10 mut seed1 := rng.state
11 seed1 += wyp0
12 rng.state = seed1
13 return hash.wymum(seed1 ^ wyp1, seed1)
14 }
15 return 0
16}
17