daily pastebin goal
36%
SHARE
TWEET

[Perl 6] Sampling from a Bag.

cwchen Nov 8th, 2017 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top