While ImageLabel's way is very correct, I am going to go into further detail, and create a table of random numbers.
##So first,
let's start by creating a table that will hold all of our numbers.
numbers = {}
##Great,
now we can setup a function that's going to generate our table. Additional detail will be given in the comments.
function GenerateTable()
checkNumber = false
for i = 1, 50 do
for _,v in pairs(numbers) do
local randomNumber = math.random(0,100)
if randomNumber == v then
checkNumber = true
end
end
if not checkNumber then
table.insert(numbers, randomNumber)
end
end
end
##Now
that we have a random set of numbers, about 50 of them, we can refer back to ImageLabel's answer for the rest.
function generateNumber()
return numbers[math.random(1,#numbers)]
end
######Note: This is all from general knowledge, none of this has been tested, and this is not the most efficient way. This is just a way to get you thinking.
Hope I helped.
1 comment
See also: https://scriptinghelpers.org/questions/16179/is-it-possible-to-pick-something-random-besides-mathrandom-exp-string-players-etc