Advertisement
cwchen

[Perl 6] Sampling from a Bag.

Nov 8th, 2017
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.12 KB | None | 0 0
  1. my $bag = (1 => 9, 2 => 5, 3 => 3, 4 => 2, 5 => 1).Bag;
  2.  
  3. loop (my $i = 0; $i < 10; $i++) {
  4.     $bag.roll(5).sort.say;
  5. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement