Skip to content

Instantly share code, notes, and snippets.

@kesava
Created April 10, 2018 17:24
Show Gist options
  • Save kesava/784f2777ebfa8751ac5a2c936a3fc0ea to your computer and use it in GitHub Desktop.
Save kesava/784f2777ebfa8751ac5a2c936a3fc0ea to your computer and use it in GitHub Desktop.
Distribution of `(rand)` function in clojure
(map (fn [[key value]] [key (count value)])
(group-by identity (take 6000000 (repeatedly #(str (rand-int 10))))))
;; (["9" 598517] ["3" 599137] ["4" 601005] ["8" 601573] ["7" 599983] ["5" 600287] ["6" 600611] ["1" 599224] ["0" 599582] ["2" 600081])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment