Skip to content

Instantly share code, notes, and snippets.

Created August 20, 2010 14:57
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 anonymous/540490 to your computer and use it in GitHub Desktop.
Save anonymous/540490 to your computer and use it in GitHub Desktop.
(defn c-rand-int
"Returns a random int >= lower and <= upper, that doesn't equal forbid"
[lower upper forbid]
(if-not (= (def rval (+ (rand-int (+ upper 1)) lower)) forbid)
rval
(c-rand-int lower upper forbid)))
(println (c-rand-int 0 7 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment