python 将有序list打乱
利用random模块下的shuffle函数就可以实现
>>> temp = [i for i in range(8)]
>>> temp
[0, 1, 2, 3, 4, 5, 6, 7]
>>> import random
>>> random.shuffle(temp)
>>> temp
[5, 2, 0, 7, 1, 4, 3, 6]
利用random模块下的shuffle函数就可以实现
>>> temp = [i for i in range(8)]
>>> temp
[0, 1, 2, 3, 4, 5, 6, 7]
>>> import random
>>> random.shuffle(temp)
>>> temp
[5, 2, 0, 7, 1, 4, 3, 6]