Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
rand
/
wyrand
/
wyrand.js.v
16
lines
·
13
sloc
·
257 bytes
·
f21cce4b6929222724c3b1097242850c58712620
Raw
1
module
wyrand
2
3
import
hash
4
5
pub
fn
(
mut
r WyRandRNG) free() {}
6
7
@[ignore_overflow; inline]
8
pub
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