mirror of
https://github.com/janet-lang/janet
synced 2024-10-31 22:16:16 +00:00
12 lines
263 B
Clojure
12 lines
263 B
Clojure
|
# 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)
|