Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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]
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #randomly #shuffle #array #python
ADD COMMENT
Topic
Name
7+5 =