Random Sample and Sort Function

  • Share this:

Code introduction


The function accepts two arguments, arg1 and arg2, generates a random sample list from arg1 to arg2, and sorts it. The number of samples is the smaller of the two arguments.


Technology Stack : random, sorting

Code Type : Sort and Random Selection

Code Difficulty : Beginner


                
                    
def aaaaa(arg1, arg2):
    import random
    return sorted(random.sample(range(arg1, arg2), min(arg1, arg2)))                
              
Tags: