Pick random element

var arr = %w(north east south west)
say arr.rand
say arr.rand(2)

Output:

south
['west', 'south']

Last updated