Answers for "how to sort array randomly pythion"

21

python randomize list

import random

random.shuffle(list)
Posted by: Guest on May-25-2020
3

randomly shuffle array python

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]
Posted by: Guest on June-17-2020

Code answers related to "how to sort array randomly pythion"

Python Answers by Framework

Browse Popular Code Answers by Language