Allow seeding RNG with a byte sequence.

This commit is contained in:
Calvin Rose
2019-11-21 22:53:39 -06:00
parent 624f5f428e
commit 02fc4ae27b
2 changed files with 40 additions and 7 deletions
+11
View File
@@ -0,0 +1,11 @@
# How random is the RNG really?
(def counts (seq [_ :range [0 100]] 0))
(for i 0 1000000
(let [x (math/random)
intrange (math/floor (* 100 x))
oldcount (counts intrange)]
(put counts intrange (if oldcount (+ 1 oldcount) 1))))
(pp counts)