Seven-sided dice from five-sided dice: Difference between revisions
Seven-sided dice from five-sided dice (view source)
Revision as of 16:47, 8 April 2018
, 6 years ago→{{header|Perl 6}}: Combine into a single block for ease of testing, remove apologies for slow speed as it is much faster now
No edit summary |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Combine into a single block for ease of testing, remove apologies for slow speed as it is much faster now) |
||
Line 1,307:
=={{header|Perl 6}}==
{{works with|Rakudo
<lang perl6>my $d5 = 1..5;
sub d5() { $d5.roll; } # 1d5
Line 1,317 ⟶ 1,316:
$flat = 5 * d5() - d5() until $flat < 21;
$flat % 7 + 1;
}
# Testing
my $n = 1_000_000;
my $expect = $n / 7;
Line 1,331:
{{out}}
<pre>Expect 142857.143
1
2
3
4
5
6
7
</pre>
=={{header|PicoLisp}}==
|