I want to do a random pick from an array but not have the same number come up twice.
array = ['1','2','3','4',]
random.choice(array)
Right now it just picks a number, is there another way so that it will randomize but only do each number once?
I want to do a random pick from an array but not have the same number come up twice.
array = ['1','2','3','4',]
random.choice(array)
Right now it just picks a number, is there another way so that it will randomize but only do each number once?
A really easy way to do this would be to remove the choice from the list, after you choose it.
my_array = ['1','2','3','4']
x = random.choice(my_array)
my_array.remove(x)