quick 均衡真随机数

math.randomseed(tostring(os.time()):reverse():sub(1, 6))
local sum1=0
local sum2=0
local sum3=0
local sum4=0
for i=1,100 do
    local num=math.random(1,4)
    if math.ceil(num)==1 then
        sum1=sum1+1
    end
    if math.ceil(num)==2 then
        sum2=sum2+1
    end
    if math.ceil(num)==3 then
        sum3=sum3+1
    end
    if math.ceil(num)==4 then
        sum4=sum4+1
    end

end

print(sum1)
print(sum2)
print(sum3)
print(sum4)

 

posted @ 2015-05-02 11:54  yufenghou  阅读(169)  评论(0编辑  收藏  举报