Seven-sided dice from five-sided dice: Difference between revisions

Content added Content deleted
No edit summary
Line 1,246: Line 1,246:
=={{header|M2000 Interpreter}}==
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
<lang M2000 Interpreter>
We make a stack object (is reference type) and pass it as a closure to dice7 lambda function. For each dice7 we pop the top value of stack, and we add a fresh dice5 (random(1,5)) as last value of stack, so stack used as FIFO. Each time z has the sum of 7 random values.
We make a stack object (is reference type) and pass it as a closure to dice7 lambda function.
For each dice7 we pop the top value of stack, and we add a fresh dice5 (random(1,5)) as last value of stack, so stack used as FIFO.
Each time z has the sum of 7 random values.


We check for uniform numbers using +-5% from expected value.
We check for uniform numbers using +-5% from expected value.
Line 1,310: Line 1,312:
Verify Uniform:uniform
Verify Uniform:uniform
</pre >
</pre >

=={{header|Mathematica}}==
=={{header|Mathematica}}==
<lang Mathematica>sevenFrom5Dice := (tmp$ = 5*RandomInteger[{1, 5}] + RandomInteger[{1, 5}] - 6;
<lang Mathematica>sevenFrom5Dice := (tmp$ = 5*RandomInteger[{1, 5}] + RandomInteger[{1, 5}] - 6;