Verify distribution uniformity/Naive: Difference between revisions

add RPL
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(add RPL)
Line 1,872:
Over 10000 runs dice5 passed distribution check
Over 100000 runs dice5 passed distribution check
</pre>
 
=={{header|RPL}}==
Calculated frequencies are negative when below/above the tolerance given by <code>delta</code>.
 
<code>DICE7</code> is defined at [[Seven-sided dice from five-sided dice#RPL|Seven-sided dice from five-sided dice]]
≪ 1 → func n delta bins
≪ { 1 } 0 CON
1 n '''FOR''' j
func EVAL
'''IF''' bins OVER < '''THEN'''
DUP 'bins' STO
1 →LIST RDM bins
'''END'''
DUP2 GET 1 + PUT
'''NEXT'''
1 bins '''FOR''' j
DUP j GET
'''IF''' DUP n bins / %CH 100 / ABS delta > '''THEN''' NEG j SWAP PUT '''ELSE''' DROP '''END'''
'''NEXT'''
≫ ≫ '<span style="color:blue">UNIF?</span>' STO
 
≪ <span style="color:blue">DICE7</span> ≫ 10000 .1 <span style="color:blue">UNIF?</span>
≪ 6 RAND * CEIL ≫ 10000 .1 <span style="color:blue">UNIF?</span>
{{out}}
<pre>
2: [ -1284 -1232 -1211 -1270 -1288 -1844 -1871 ]
1: [ 1564 1773 1670 1629 1613 1751 ]
</pre>
 
1,150

edits