1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
# testsuite_random_include section for BASIC256
# Modification History
# date programmer description
# 20140813 j.m.reneau split from testsuite
currentsuite = "random"
clg
fastgraphics
min = rand
max = rand
tot = 0
k = 100000
for t = 1 to k
n = rand
if n < min then min = n
if n > max then max = n
tot = tot + n
plot n*300,t%300
if t%1000=0 then
refresh
color rgb(rand*256, rand*256, rand*256)
end if
next t
tot = tot / k
call n("rand min "+min+">= 0..", min >=0, true)
call n("rand max "+max+"< 1", max < 1, true)
call n("rand avg "+tot+" ~ .5", tot>=.49 and tot<=.51, true)
|