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() //= e.g. 3 [1, 2, 3, 4].random(2) //= e.g. [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() //= e.g. 3 [1, 2, 3, 4].random(2) //= e.g. [1, 4]