Randomly Shuffle List Elements

  • Share this:

Code introduction


This function takes a list as input and randomly shuffles its elements.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

def shuffle_list(input_list):
    """
    Randomly shuffles the elements of the input list.
    """
    random.shuffle(input_list)
    return input_list                
              
Tags: