Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,12 @@
(defn verify [rand n & [delta]]
(let [rands (frequencies (repeatedly n rand))
avg (/ (reduce + (map val rands)) (count rands))
max-delta (* avg (or delta 1/10))
acceptable? #(<= (- avg max-delta) % (+ avg max-delta))]
(for [[num count] (sort rands)]
[num count (acceptable? count)])))
(doseq [n [100 1000 10000]
[num count okay?] (verify #(rand-int 7) n)]
(println "Saw" num count "times:"
(if okay? "that's" " not") "acceptable"))