Skip to content

Instantly share code, notes, and snippets.

@mrBliss
Created August 20, 2010 15:04
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 mrBliss/540504 to your computer and use it in GitHub Desktop.
Save mrBliss/540504 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]
(let [rval (+ (rand-int (+ upper 1)) lower)]
(if (= forbid rval)
(recur lower upper forbid)
rval)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment