Random Number Generator within Range

  • Share this:

Code introduction


This function takes two parameters, min_value and max_value, and returns a random integer within this range.


Technology Stack : random

Code Type : Python Function

Code Difficulty : Intermediate


                
                    
def get_random_number(min_value, max_value):
    """
    Generate a random number within the specified range.
    """
    import random
    return random.randint(min_value, max_value)                
              
Tags: