First page Back Continue Last page Overview Graphics

Randomly shuffling lists

>>> l = range(15)

>>> l

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

>>> np.random.shuffle(l)

>>> l

[0, 14, 9, 13, 6, 5, 11, 3, 2, 7, 10, 12, 4, 1, 8]

>>> np.random.shuffle(l)

>>> l

[11, 13, 14, 6, 5, 2, 4, 7, 1, 12, 9, 8, 10, 0, 3]

>>>