I have a list of numbers l = [0,1,2,3,4,5,6,7,8,9]
from which I want to choose random numbers, without ever repeating the last chosen one.
So, if I generate a sequence of random numbers, the same should never be chosen twice in a row.
I select a random number from this list using the random.choice()
method. If I get 4
the first time, it can't be chosen again on the second iteration, but will be available again on the third one.
How can I do that? Is there any package available in Python that provides random numbers this way?