Subject: | "sample" or "choice" function |
It would be nice to have a function that returns a random element from the list. It could also be extended to allow specifying a number of random elements to return in one call, and whether to allow repeats - or just always disallow repeats, so the behavior of allowing repeats is implemented by calling the function multiple times.
my @random_three = sample 3, @items;
The only similar precedent I can find at the moment is the python "choice" and "choices" functions. https://docs.python.org/3/library/random.html#random.choice