When I shuffle several sublists they come out in the same order. I'm sure I can reseed it with a random number each time, but everything I read implies that I shouldn't have to.
Code:
test=[list(range(10))]*5
import random
for x in test:
random.shuffle(x)
print(test)
Results:
[[0, 8, 9, 6, 1, 2, 7, 4, 5, 3], [0, 8, 9, 6, 1, 2, 7, 4, 5, 3], [0, 8, 9, 6, 1, 2, 7, 4, 5, 3], [0, 8, 9, 6, 1, 2, 7, 4, 5, 3], [0, 8, 9, 6, 1, 2, 7, 4, 5, 3]]
Why isn't shuffle producing different orders?
Aucun commentaire:
Enregistrer un commentaire