📜  随机洗牌数组python代码示例

📅  最后修改于: 2022-03-11 14:46:10.825000             🧑  作者: Mango

代码示例2
import random
l = list(range(5))
print(l)
# [0, 1, 2, 3, 4]

lr = random.sample(l, len(l))
print(lr)
# [3, 2, 4, 1, 0]

print(l)
# [0, 1, 2, 3, 4]