2021-03-16 10:37:05 +01:00
|
|
|
import crypto.rand
|
|
|
|
|
|
|
|
fn test_reading() ? {
|
2022-05-13 05:56:21 +02:00
|
|
|
a := rand.read(32)?
|
2021-03-16 11:04:50 +01:00
|
|
|
// dump(a.hex())
|
2021-03-16 10:37:05 +01:00
|
|
|
assert a.len == 32
|
|
|
|
mut histogram := [256]int{}
|
|
|
|
for b in a {
|
|
|
|
histogram[b]++
|
|
|
|
}
|
2021-03-16 11:04:50 +01:00
|
|
|
// dump(histogram)
|
2021-03-16 10:37:05 +01:00
|
|
|
for h in histogram {
|
|
|
|
assert h < 10
|
|
|
|
}
|
|
|
|
}
|