mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tests: stats_test.v, pcg32_test.v, splitmix64_test.v now also pass
This commit is contained in:
@ -2,6 +2,15 @@
|
||||
import rand
|
||||
import time
|
||||
|
||||
fn show_u32s(a []u32){
|
||||
mut res := []string
|
||||
for x in a {
|
||||
res << x.str()
|
||||
}
|
||||
print('[')
|
||||
print(res.join(', '))
|
||||
println(']')
|
||||
}
|
||||
fn gen_randoms(initstate i64, initseq i64, bound int) []u32 {
|
||||
mut randoms := [u32(0)].repeat(20)
|
||||
mut rnd := rand.new_pcg32( u64(initstate), u64(initseq) )
|
||||
@ -18,8 +27,8 @@ fn test_pcg32_reproducibility() {
|
||||
randoms1 := gen_randoms(t, tseq, 1000)
|
||||
randoms2 := gen_randoms(t, tseq, 1000)
|
||||
assert randoms1.len == randoms2.len
|
||||
println( randoms1 )
|
||||
println( randoms2 )
|
||||
show_u32s(randoms1)
|
||||
show_u32s(randoms2)
|
||||
len := randoms1.len
|
||||
for i in 0..len {
|
||||
assert randoms1[i] == randoms2[i]
|
||||
|
Reference in New Issue
Block a user