Documentation for routine pick

Documentation for routine pick, assembled from the following types:

class List

From List

routine pick

multi sub    pick($count, *@list) returns List:D
multi method pick(List:D: $count = 1)

Returns $count elements chosen at random and without repetition from the invocant. If * is passed as $count, or $count is greater than or equal to the size of the list, then all elements from the invocant list are returned in a random sequence.

Examples:

say <a b c d e>.pick;           # b
b
say <a b c d e>.pick: 3;        # c a e
say  <a b c d e>.pick: *;       # e d a b c

role Baggy

From Baggy

method pick

role Setty

From Setty

method pick

multi method pick($count = 1)

Returns $count elements chosen at random (without repetition) from the set.

If * is passed as $count, or $count is greater than or equal to the size of the set, then all its elements are returned in random order.