P23 - Extract a given number of randomly selected elements from a list.

Author: Ryan Connelly

Example

> say get-rand-elems(<a b c d e>, 3);
c b a

Source code: P23-topo.pl

use v6;

sub get-rand-elems(@list, $amount) {
    @list.pick($amount);
}

say "{get-rand-elems(<a b c d e>, 3)}";