Random List Shuffler Function

  • Share this:

Code introduction


This function takes a list of items as an argument and returns a new list with the items shuffled randomly.


Technology Stack : random

Code Type : Function

Code Difficulty : Beginner


                
                    
import random

def shuffle_list(items):
    """
    Randomly shuffle a list of items.
    """
    return random.sample(items, len(items))                
              
Tags: