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 returns a list with the elements shuffled randomly.
Technology Stack : random
Code Type : Function
Code Difficulty : Intermediate
import random
def shuffle_list(input_list):
"""
随机打乱列表中元素顺序的函数。
Args:
input_list (list): 要打乱的列表。
Returns:
list: 打乱顺序后的列表。
"""
shuffled_list = input_list[:]
random.shuffle(shuffled_list)
return shuffled_list
# JSON 格式输出