I am attempting to generate a list five times using only one while loop and only one list of numbers. I have written code that seems fine to me but the list is generating once and then it generates the same list for the other tests. I want a random list everytime. I do not know what is wrong so I don't know how to tackle it. Any help would be appreciated.
Here is my code:
import random, time
number = 23
counter = 0
total = 5
counter2 = 0
current = 0
numbers = []
tally = 1
trash = []
while counter < total:
while counter2 < number:
for x in range(1):
current = random.randint(1, 366)
time.sleep(0.0001)
counter2 += 1
numbers.append(current)
numbersS = set(numbers)
size = len(numbersS)
if size < number:
print("1")
else:
print("0")
counter += 1
numbers = trash
Aucun commentaire:
Enregistrer un commentaire