Random Selection Function

  • Share this:

Code introduction


Selects and returns one item from the specified parameters. If the parameter list is empty, it raises a ValueError.


Technology Stack : random (random number generation)

Code Type : Function

Code Difficulty : Intermediate


                
                    
def random_choice(arg1, arg2, arg3, arg4, arg5):
    from random import choice
    return choice(arg1, arg2, arg3, arg4, arg5)