function random(min, max)
r = math.random(min, max)
return r
end
function calc(prob, maxi)
if maxi then
if prob > maxi then
error("Prob. higher than "..maxi..". Enter a number at second parameter or decrease the prob. rate.")
else
prob = tonumber(prob)
pr = random(1, maxi)
if pr < prob then
return true
else
return false
end
end
else
if prob > 100 then
error("Prob. higher than 100. Enter a number at second parameter or decrease the prob. rate.")
else
prob = tonumber(prob)
pr = random(1, 100)
if pr < prob then
return true
else
return false
end
end
end
end
local function error(param)
printError(param)
end
r = math.random(min, max)
return r
end
function calc(prob, maxi)
if maxi then
if prob > maxi then
error("Prob. higher than "..maxi..". Enter a number at second parameter or decrease the prob. rate.")
else
prob = tonumber(prob)
pr = random(1, maxi)
if pr < prob then
return true
else
return false
end
end
else
if prob > 100 then
error("Prob. higher than 100. Enter a number at second parameter or decrease the prob. rate.")
else
prob = tonumber(prob)
pr = random(1, 100)
if pr < prob then
return true
else
return false
end
end
end
end
local function error(param)
printError(param)
end