How can we pick more random of these numbers like for example
local random = (5,10,7,6,2,1)
How can we pick a number from all of these numbers?
How can we pick more random of these numbers like for example
local random = (5,10,7,6,2,1)
How can we pick a number from all of these numbers?
Place these numbers within a table.
We can generate a random number via math.random, between 1-n—where n is the length of the array. This will select a random index, picking a number from the list:
local random = {5, 10, 7, 6, 2, 1}
local randomNumber = random[math.random(1, #random)]
print(randomNumber) -> 6
This discussion is preserved as it was. New answers, comments, and votes are closed.