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

m (→‎{{header|Verilog}}: Remove vanity tags)
Line 1,338:
6 142988 +0.09%
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>
 
7,794

edits