Reputation: 929
Suppose I have a Vector
like:
["Cat", "Dog", "Chicken", "Caribou"]
How can I uniformly randomly select an item?
Upvotes: 6
Views: 2896
Reputation: 6388
It's as simple as
v=["Cat", "Dog", "Chicken", "Caribou"]
rand(v)
Upvotes: 13