level 5
村长丶那人偷牛
楼主
function RandomLottery()
local CurrentAwards;
local A1,A2,A3,A4,A5,A6,A7,A8;
local RandomNumber = math.random(1,10000); --取1到1w随机数
A1 = "10000元" --设置中奖几率为10000分之一
A2 = "8888元" --设置中奖几率为5000分之一
A3 = "5000元" --设置中奖几率为2000分之一
A4 = "2000元" --设置中奖几率为1000分之一
A5 = "888元" --设置中奖几率为500分之一
A6 = "200元" --设置中奖几率为100分之一
A7 = "100元" --设置中奖几率为10分之一
if RandomNumber == 1 then
CurrentAwards = A1;
elseif RandomNumber <= 2 then
CurrentAwards = A2;
elseif RandomNumber <= 5 then
CurrentAwards = A3;
elseif RandomNumber <= 10 then
CurrentAwards = A4;
elseif RandomNumber <= 20 then
CurrentAwards = A5;
elseif RandomNumber <= 100 then
CurrentAwards = A6;
elseif RandomNumber <= 1000 then
CurrentAwards = A7;
else
CurrentAwards = "抱歉,您没有中奖,请再接再厉!";
end;
return CurrentAwards;
end;
2016年03月05日 01点03分
1
local CurrentAwards;
local A1,A2,A3,A4,A5,A6,A7,A8;
local RandomNumber = math.random(1,10000); --取1到1w随机数
A1 = "10000元" --设置中奖几率为10000分之一
A2 = "8888元" --设置中奖几率为5000分之一
A3 = "5000元" --设置中奖几率为2000分之一
A4 = "2000元" --设置中奖几率为1000分之一
A5 = "888元" --设置中奖几率为500分之一
A6 = "200元" --设置中奖几率为100分之一
A7 = "100元" --设置中奖几率为10分之一
if RandomNumber == 1 then
CurrentAwards = A1;
elseif RandomNumber <= 2 then
CurrentAwards = A2;
elseif RandomNumber <= 5 then
CurrentAwards = A3;
elseif RandomNumber <= 10 then
CurrentAwards = A4;
elseif RandomNumber <= 20 then
CurrentAwards = A5;
elseif RandomNumber <= 100 then
CurrentAwards = A6;
elseif RandomNumber <= 1000 then
CurrentAwards = A7;
else
CurrentAwards = "抱歉,您没有中奖,请再接再厉!";
end;
return CurrentAwards;
end;