Lua math.random

This article is tagged with: Lua math.random and lua

lua math.random

local M = math.random(1,2) --Input you number
print(M)

lua math.random

local randomNumberGenerator = math.random(1,5)
if randomNumberGenerator == 1 then
print("1")
elseif randomNumberGenerator == 2 then
print("2")
elseif randomNumberGenerator == 3 then
print("3")
elseif randomNumberGenerator == 4 then
print("4")
elseif randomNumberGenerator == 5 then
print("5")
end

This article is tagged with: Lua math.random and lua