Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dice_2d6 = {};
- for i = 1, 12 do
- dice_2d6[i]=0;
- end
- math.randomseed(os.time());-- инициализация генератора случайных чисел
- count = 100000; -- число испытаний
- for i = 1, count do
- local result = math.random(1,6)+math.random(1,6);
- dice_2d6[result]=dice_2d6[result]+1;
- end
- for i = 2, 12 do
- print ("Dice[".. i .."] = " .. 100*dice_2d6[i]/count .."%");
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement