List.random
random($numItems=1) -> any|list
Description
Get a random sample of items from the list.
If $numItems
is 1, a single item will be returned.
[1, 2, 3, 4].random() //= Ex: 3 [1, 2, 3, 4].random(2) //= Ex: [1, 4]
Get a random sample of items from the list.
If $numItems
is 1, a single item will be returned.
[1, 2, 3, 4].random() //= Ex: 3 [1, 2, 3, 4].random(2) //= Ex: [1, 4]