1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

rand: separate rand.util and rand.seed submodules (#8353)

This commit is contained in:
Subhomoy Haldar
2021-01-26 19:25:09 +05:30
committed by GitHub
parent 5f2b2df546
commit 97103f680a
16 changed files with 107 additions and 104 deletions

View File

@@ -3,6 +3,7 @@
// that can be found in the LICENSE file.
module pcg32
import rand.seed
import rand.util
// PCG32RNG ported from http://www.pcg-random.org/download.html,
@@ -10,8 +11,8 @@ import rand.util
// https://github.com/imneme/pcg-c-basic/blob/master/pcg_basic.h
pub struct PCG32RNG {
mut:
state u64 = u64(0x853c49e6748fea9b) ^ util.time_seed_64()
inc u64 = u64(0xda3e39cb94b95bdb) ^ util.time_seed_64()
state u64 = u64(0x853c49e6748fea9b) ^ seed.time_seed_64()
inc u64 = u64(0xda3e39cb94b95bdb) ^ seed.time_seed_64()
}
// seed seeds the PCG32RNG with 4 `u32` values.