v / vlib / crypto / rand / crypto_rand_bytes_test.v
15 lines · 14 sloc · 225 bytes · 51f4d99399f88da0abf4d48d2317eaa8f3e630f5
Raw
1import crypto.rand
2
3fn test_reading() {
4 a := rand.read(32)!
5 // dump(a.hex())
6 assert a.len == 32
7 mut histogram := [256]int{}
8 for b in a {
9 histogram[b]++
10 }
11 // dump(histogram)
12 for h in histogram {
13 assert h < 10
14 }
15}
16