Advertisement
cwchen

[Perl 6] Sampling from a Mix.

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