rand-int

clojure.core

  • (rand-int n)
Returns a random integer between 0 (inclusive) and n (exclusive).

1 Example top

  • user=> (rand-int 30)
    10
    
    user=> (rand-int 30)
    7
    
    ;compare with 
    user=> (int (rand 30))
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:4325 top

(defn rand-int
  "Returns a random integer between 0 (inclusive) and n (exclusive)."
  {:added "1.0"
   :static true}
  [n] (int (rand n)))
Vars in clojure.core/rand-int:
Used in 0 other vars

Comments top

No comments for rand-int. Log in to add a comment.