mirror of
https://github.com/janet-lang/janet
synced 2026-02-23 18:39:47 +00:00
This does create a lot of warnings, especially in the test suite, but should improve code and point out real issues. To disable individual messages, either disable linting, add the metadata :unused to a binding, or add the prefix "_" to a symbol.
12 lines
262 B
Janet
12 lines
262 B
Janet
# How random is the RNG really?
|
|
|
|
(def counts (seq [_ :range [0 100]] 0))
|
|
|
|
(repeat 1000000
|
|
(let [x (math/random)
|
|
intrange (math/floor (* 100 x))
|
|
oldcount (counts intrange)]
|
|
(put counts intrange (if oldcount (+ 1 oldcount) 1))))
|
|
|
|
(pp counts)
|