← How-To Guides How-To How to shuffle a list Use random.shuffle(lst) to shuffle in place. Use random.sample(lst, k) for a random sample. shuffle shuffle mutates the list. import random lst = [1,2,3,4] random.shuffle(lst)