Verify distribution uniformity/Naive: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed/added whitespace and comments, centered the result.) |
m (→{{header|REXX}}: used a simplier (and faster) form of a DO loop.) |
||
Line 1,210: | Line 1,210: | ||
highDig=9 /*use this var for the highest digit. */ |
highDig=9 /*use this var for the highest digit. */ |
||
!.=0 /*initialize all possible random trials*/ |
!.=0 /*initialize all possible random trials*/ |
||
do |
do t /* [↓] perform a bunch of trials. */ |
||
if f=='RANDOM' then ?=random(0,highDig) /*random function.*/ |
if f=='RANDOM' then ?=random(0,highDig) /*random function.*/ |
||
else interpret '?='f"(0,"highDig')' /* user function.*/ |
else interpret '?='f"(0,"highDig')' /* user function.*/ |
||
!.?=!.?+1 /*bump the counter*/ |
!.?=!.?+1 /*bump the counter*/ |
||
end /* |
end /*t*/ /* [↑] store trials ───► pigeonholes. */ |
||
/* [↓] compute the digit's skewness. */ |
/* [↓] compute the digit's skewness. */ |
||
g=t/(1+highDig) /*calculate number of each digit throw.*/ |
g=t/(1+highDig) /*calculate number of each digit throw.*/ |