Hi folks,
The header might sound confusing but it’s quite simple. (haha not enough that I have done it though :P)
I want to randomise a number ( 1, 2 or 3) and do some calculations based off of it.
Then randomise another number from the same range but without the number already chosen.
So for example:
math.random(1,3)
*Chose 2 - Do Stuff*
Now random again but only the numbers 1 & 3.
*Chose 1 - Do Stuff*
Now random again but only the remaining numbers - in this case 1.
I tried setting up a table and drawing numbers out like this:
t = {1,2,3} randNum = t[math.random(#t)] -- chose a number from the table (Position). table.remove(t, randNum) --remove that number.
The problem is it takes the values position in the table, which at first syncs up.
After you remove that value (Again it takes away the position not the value)
It doesn’t sync anymore.
Example:
if the 1st number chose is 2.
It removes value 2 (Or more accurately it removes whatever value is at position 2)
then shifts the values down. so we have
{1,3}
which is now positionally:
1,2
Do you see what I mean?
Hopefully there’s an easy way to read and remove the actual table value.
Thanks for the help.