Randomly Shuffled List Generator

  • Share this:

Code introduction


This function takes a list as an argument and returns a new list with elements in a random order.


Technology Stack : random

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random

def shuffle_list(lst):
    return random.sample(lst, len(lst))                
              
Tags: