Skip to content
Newer
Older
100644 20 lines (14 sloc) 419 Bytes
45e025b Fix #1 by conditional roll subroutine.
GlitchMr authored Dec 1, 2012
1 my &safe-roll = (try { (1..6).pick(4, :replace) })
2 ?? ({ $^a.pick: $^b, :replace })
3 !! ({ $^a.roll: $^b });
4
09a486c @colomon Add script to check the statistics of rolling D&D characters using 4d…
colomon authored Sep 4, 2010
5 my $chars-to-roll = 600;
6 my @count = 0 xx 20;
7
8 for ^$chars-to-roll {
45e025b Fix #1 by conditional roll subroutine.
GlitchMr authored Dec 1, 2012
9 my @a = (^6).map({ [+] safe-roll(1..6, 4).sort(-*)[^3] }).sort(-*);
09a486c @colomon Add script to check the statistics of rolling D&D characters using 4d…
colomon authored Sep 4, 2010
10 for @a { @count[$_]++ };
11 # say ~@a;
12 }
13
14 say " ";
15
16 for 3..18 {
17 say "$_ rolled { @count[$_] } times ({ @count[$_] / ($chars-to-roll * 6) * 100 }%)";
18 }
19
Something went wrong with that request. Please try again.