Randomly Shuffle List Function

  • Share this:

Code introduction


This function takes a list as input and returns it after shuffling it randomly.


Technology Stack : random, list

Code Type : List scrambled

Code Difficulty : Intermediate


                
                    
import random
import json

def shuffle_list(input_list):
    if not input_list:
        return []
    random.shuffle(input_list)
    return input_list                
              
Tags: