Reputation: 58796
If I have a list like:
["apples" "pears" "oranges"]
What is the the easiest way to get a random item from here?
Upvotes: 6
Views: 2106
Reputation: 91577
rand-nth should do the trick:
user> (rand-nth ["apples" "pears" "oranges"])
"pears"
user> (rand-nth ["apples" "pears" "oranges"])
"oranges"
user> (rand-nth ["apples" "pears" "oranges"])
"oranges"
Upvotes: 15