Efficient way to generate a variable

In reply to dave_59:

O(n) : Order of n.
Each time the simulation tries to solve this constraint to ensure the random value is not the same as any of the reset value in the queue, it has to somehow compare the random value against all values in the queue. So checking whether a random value is one of the reset values is Order(n). assuming the queue has n elements.

O(1) : Order of 1 means not looping through all n elements of the queue and doing it in one shot.