vendredi 1 novembre 2019

Random.shuffle surprisingly doesn't work inside loop

Random.shuffle surprisingly doesn't work inside loop, it always produce the same shuffled list, but i need 19 different lists in order:

for i in range(19):
    random.seed() #random.randint(1, 50)
    random.shuffle(candidates_random_list)
    random.seed()
    candidates_full_list.append(candidates_random_list)
print('candidates_full_list ----- \n\n ')
pprint(candidates_full_list)

I saw a lot of tutorials and expected seed() will solve this, but it is in my opinion misbehavior. Every run it shuffle, but not in loop.




Aucun commentaire:

Enregistrer un commentaire