Jump to content

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

m
No edit summary
Line 1,246:
=={{header|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.
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.
Line 1,310 ⟶ 1,312:
Verify Uniform:uniform
</pre >
 
=={{header|Mathematica}}==
<lang Mathematica>sevenFrom5Dice := (tmp$ = 5*RandomInteger[{1, 5}] + RandomInteger[{1, 5}] - 6;
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.