Skip to content

Instantly share code, notes, and snippets.

@ecounysis
Created February 25, 2012 00:38
Show Gist options
  • Save ecounysis/1904920 to your computer and use it in GitHub Desktop.
Save ecounysis/1904920 to your computer and use it in GitHub Desktop.
Clojure Dice
(defn make-die [sides]
(fn [] (+ 1 (rand-int sides))))
(def d20 (make-die 20))
(def d6 (make-die 6))
(def d4 (make-die 4))
(def d10 (make-die 10))
(def d12 (make-die 12))
(def d100 (make-die 100))
(def d1000 (make-die 1000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment