In-Place List Shuffling Function

  • Share this:

Code introduction


Shuffles the elements of the list in place.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

def shuffle_list(items):
    """
    Shuffle the elements of the list in place.
    """
    random.shuffle(items)

    return items                
              
Tags: