28 lines
847 B
Text
28 lines
847 B
Text
constant {names, probs} = columnize({{"aleph", 1/5},
|
|
{"beth", 1/6},
|
|
{"gimel", 1/7},
|
|
{"daleth", 1/8},
|
|
{"he", 1/9},
|
|
{"waw", 1/10},
|
|
{"zayin", 1/11},
|
|
{"heth", 1759/27720}})
|
|
|
|
sequence results = repeat(0,length(names))
|
|
|
|
atom r
|
|
constant lim = 1000000
|
|
for j=1 to lim do
|
|
r = rnd()
|
|
for i=1 to length(probs) do
|
|
r -= probs[i]
|
|
if r<=0 then
|
|
results[i]+=1
|
|
exit
|
|
end if
|
|
end for
|
|
end for
|
|
|
|
printf(1," Name Actual Expected\n")
|
|
for i=1 to length(probs) do
|
|
printf(1,"%6s %8.6f %8.6f\n",{names[i],results[i]/lim,probs[i]})
|
|
end for
|