You can download this code by clicking the button below.
This code is now available for download.
This function takes a list as input and uses the shuffle method from the random library to randomly shuffle the order of elements in the list.
Technology Stack : random
Code Type : Function
Code Difficulty : Intermediate
import random
def shuffle_list(input_list):
"""
将列表中的元素随机打乱顺序。
:param input_list: 要打乱的列表
:return: 打乱顺序后的列表
"""
random.shuffle(input_list)
return input_list