-
-
Save tomjack/d24bf93fb851b9835305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns w.t.f) | |
(defn random-long [] | |
(.nextLong (java.util.Random.))) | |
(comment | |
w.t.f> (let [n 1e6 | |
m 20] | |
(->> #(->> random-long | |
(repeatedly n) | |
(filter pos?) | |
count) | |
(repeatedly m) | |
(map #(/ % n)))) | |
(0.481048 0.480619 0.480824 0.481071 0.480968 0.480727 0.481286 0.480591 0.480672 0.480753 0.481099 0.480903 0.480823 0.480889 0.480922 0.480708 0.48112 0.480826 0.480775 0.481052) | |
w.t.f> (let [n 1e6 | |
m 20] | |
(->> #(->> random-long | |
(repeatedly n) | |
(filter neg?) | |
count) | |
(repeatedly m) | |
(map #(/ % n)))) | |
(0.474994 0.474724 0.475142 0.475168 0.474941 0.47506 0.475124 0.474839 0.47472 0.475202 0.474874 0.475147 0.475025 0.474961 0.47479 0.474962 0.475064 0.475094 0.474634 0.475079) | |
w.t.f> (let [n 1e6 | |
m 20] | |
(->> #(->> random-long | |
(repeatedly n) | |
(filter zero?) | |
count) | |
(repeatedly m) | |
(map #(/ % n)))) | |
(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment