random number generator /w chance

Run Settings
Language Version
Run Command
local chance = 50 local times = 5 --[[ this basically generates a random number between 1 and the chance variable above and the times variable above is how many numbers it will generate --]] local calculatedchance = chance for i=0, times-2 do calculatedchance = calculatedchance*2 end local percentagechance = 1/calculatedchance*100 if times >1 then print("done (chance of all numbers being the same is 1/"..calculatedchance.." or "..percentagechance.."%)") print("numbers generated are") else print("done") print("number generated is") end math.randomseed(os.time()) for i=0, times-1 do local a = math.random(1,chance) print(a) end
Editor Settings
Key bindings
Full width