Seven-sided dice from five-sided dice: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Verilog}}: Remove vanity tags) |
|||
Line 1,338: | Line 1,338: | ||
6 142988 +0.09% |
6 142988 +0.09% |
||
7 142713 -0.10% |
7 142713 -0.10% |
||
</pre> |
|||
=={{header|Phix}}== |
|||
replace rand7() in [[Verify_distribution_uniformity/Naive#Phix]] with: |
|||
<lang Phix>function rand5() |
|||
return rand(5) |
|||
end function |
|||
function rand7() |
|||
while true do |
|||
integer r = rand5()*5+rand(5)-3 -- ( ie 3..27, but ) |
|||
if r<24 then return floor(r/3) end if -- (only 3..23 useful) |
|||
end while |
|||
end function</lang> |
|||
{{out}} |
|||
<pre> |
|||
1000000 iterations: flat |
|||
</pre> |
</pre> |
||