rand-nth

added
1.2

ns
clojure.core

type
function

(rand-nth coll)

Return a random element of the (sequential) collection. Will have
the same performance characteristics as nth for the given
collection.

                user=> (def food [:ice-cream :steak :apple])
#'user/food

user=> (rand-nth food)
:apple
user=> (rand-nth food)
:ice-cream

            
                user=> (def food [:ice-cream :steak :apple])
#'user/food

user=> (rand-nth food)
:ice-cream
user=> (rand-nth food)
:ice-cream