Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I know the common idiom of getting a random array element: $array[int rand @array];. I can then extend that to return a random number of elements: @array[0 .. int rand @array];. But I need to also sometimes get 0 elements. Is there a more succinct way than to have two statements like this? my @subset = @array[0 .. int rand(1 + @array); @subset = () if @subset > @array;