1
0
mirror of https://github.com/janet-lang/janet synced 2026-02-23 18:39:47 +00:00
Files
janet/examples/rtest.janet
Calvin Rose ddc7cc5ae4 Warn on unused bindings (strict lint).
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.
2026-01-10 07:59:11 -06:00

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)