Avoid repetition in Randomness

How can I avoid a certain number from being repeated in a RandomInRange?
I’m trying to have 4 different backgrounds switch between them randomly, each having its own variable. The problem arises with backgrounds 2 and 3. I don’t want it to get the value 2 again from the RandomInRange if the background on screen is #2. Or perhaps there’s another, more direct way of simply choosing randomly from 1,3 and 4? I can’t seem to get around it. I tried setting up a counter but it doesn’t work.

1 - Compare two numbers
Check if MyArray have 0 children
So it will automatically generate new children

2 - Set IncreaseIndex variable to 0 so it always start from 0 and go UP when new child distribution starts

3 - How many numbers/child you want to have? -1
For example if there is 10 then you will have 0 to 9
If you put there 23 then it will be from 0 to 22

4 - Add IncreaseIndex variable to MyArray as new child
So since in step 2 IncreaseIndex was reset to 0
Then first child will have number 0 with index 0
And since we are repeating it 10 times in step 3 it will go
0 1 2 3 4 5 6 7 8 9

5 - After one child is added add 1 to IncreaseIndex variable
So when next child is going to be added it will have +1 number to previous child
So if previous had number 0 next will have 1 and then next one will have 2 and so go on

PRESS SPACE
6 - Change variable RNG to to Random In Range 0 to How many child variables MyArray have -1
Since in step 2 we set it to 10 then it will be RandomInRange 0 , 9

7 - Change text to MyArray [ Child variable at index Whatever RNG variable number had ]

8 - Remove child from MyArray by its index number and number = whatever number RNG variable had

1 Like