Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
(import
|
||||
[scipy.stats [chisquare]]
|
||||
[collections [Counter]])
|
||||
|
||||
(defn uniform? [f repeats &optional [alpha .05]]
|
||||
"Call 'f' 'repeats' times and do a chi-squared test for uniformity
|
||||
of the resulting discrete distribution. Return false iff the
|
||||
null hypothesis of uniformity is rejected for the test with
|
||||
size 'alpha'."
|
||||
(<= alpha (second (chisquare
|
||||
(.values (Counter (take repeats (repeatedly f))))))))
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(import [random [randint]])
|
||||
|
||||
(for [f [
|
||||
(fn [] (randint 1 10))
|
||||
(fn [] (if (randint 0 1) (randint 1 9) (randint 1 10)))]]
|
||||
(print (uniform? f 5000)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue