Files
30-seconds-of-code/test/shuffle/shuffle.py
2018-04-14 10:54:46 +00:00

12 lines
259 B
Python

from copy import deepcopy
from random import randint
def shuffle(lst):
temp_lst = deepcopy(lst)
m = len(temp_lst)
while (m):
m -= 1
i = randint(0, m)
temp_lst[m], temp_lst[i] = temp_lst[i], temp_lst[m]
return temp_lst