I want to set a value to a random whole number but I do not want it to repeat the same number unless it has given 2 different numbers before it.
example: Lets say I want to get a random number 1-4 each time I push a button it will random a number between those values.
lets say it gives me 1 now I do not want to get 1 the next time 2x I push the button, but after that I want 1 to go back into the pool of random numbers
so the out of a string of 4 times I random the number I wont ever get
1,1,1,1
1,1,4,1
1,2,1,2
1,2,3,2
etc...
combinations I would get would be
1,2,3,4
1,2,4,1
1,4,2,3
2,4,3,1
etc...
I know a array could do something like this but I am unsure how to set it up
anyone have any ideas?