Randomly Shuffle List Elements Function

  • Share this:

Code introduction


This function takes a list as an argument and randomly shuffles the elements of the list in place.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

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