A quick suggestion about rand-int. It would be useful if you could
supply it with a second argument to give a random integer over a
range. For example, (rand-int 5 10) to give a random integer between 5
(inclusive) and 10 (exclusive):

===================================================================
--- src/clj/clojure/core.clj    (revision 1332)
+++ src/clj/clojure/core.clj    (working copy)
@@ -2893,7 +2893,8 @@

 (defn rand-int
   "Returns a random integer between 0 (inclusive) and n (exclusive)."
-  [n] (int (rand n)))
+  ([n] (int (rand n)))
+  ([x n] (+ (rand-int (- n x)) x)))

 (defmacro defn-
   "same as defn, yielding non-public def"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to