Possible Duplicate:
Shuffling a list of objects in python
IF I have a list:
a = ["a", "b", "c", ..., "zzz"]
how can I randomly shuffle its elements in order to obtain a list:
b = ["c", "zh", ...]
without consuming a lot of the system's resources?
Possible Duplicate:
Shuffling a list of objects in python
IF I have a list:
a = ["a", "b", "c", ..., "zzz"]
how can I randomly shuffle its elements in order to obtain a list:
b = ["c", "zh", ...]
without consuming a lot of the system's resources?
Not sure how much resources it consumes, but shuffle in the random module does exactly like this.
import random
a = [1,2,3,4,5]
random.shuffle(a)