Skip to content

Instantly share code, notes, and snippets.

@classmember
Created November 16, 2021 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save classmember/b3524988595146e0bacf3bbe7c019540 to your computer and use it in GitHub Desktop.
Save classmember/b3524988595146e0bacf3bbe7c019540 to your computer and use it in GitHub Desktop.
rolls a 20 sided dice in Clojure
;; roll-20-sided-dice.clj
;; return a function that rolls a 20 sided dice
(def roll-20-sided-dice
(fn [] (inc (int (rand 19)))))
;; call function to roll 20 sided dice
(roll-20-sided-dice)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment