You're viewing version 1.2.0 of shuffle. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

shuffle

clojure.core

  • (shuffle coll)
Return a random permutation of coll

1 Example top

  • user=> (repeatedly 5 (partial shuffle [1 2 3]))
    ([1 2 3] [1 2 3] [1 2 3] [1 2 3] [3 1 2])
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:5610 top

(defn shuffle
  "Return a random permutation of coll"
  {:added "1.2"}
  [coll]
  (let [al (java.util.ArrayList. coll)]
    (java.util.Collections/shuffle al)
    (clojure.lang.RT/vector (.toArray al))))
Vars in clojure.core/shuffle: defn let
Used in 2 other vars shuffle shuffle

Comments top

No comments for shuffle. Log in to add a comment.