v2 / vlib / time / misc / misc_test.v
17 lines · 16 sloc · 448 bytes · 1363cc85fd6ca1945446d8e7eed499db25b1ce7f
Raw
1import time.misc as tmisc
2import rand
3
4fn test_random() {
5 // guarantee CI test stability, by seeding the random number generator with a known seed
6 rand.seed([u32(0), 0])
7 t1 := tmisc.random()
8 t2 := tmisc.random()
9 t3 := tmisc.random()
10 t4 := tmisc.random()
11 assert t1.unix() != t2.unix()
12 assert t1.unix() != t3.unix()
13 assert t1.unix() != t4.unix()
14 assert t2.unix() != t3.unix()
15 assert t2.unix() != t4.unix()
16 assert t3.unix() != t4.unix()
17}
18