Random Number Generator Function

  • Share this:

Code introduction


The function uses the built-in Python random module to generate a random integer within the specified range.


Technology Stack : Built-in Python random module

Code Type : The type of code

Code Difficulty : Intermediate


                
                    
import random
import pytest

def generate_random_number(min_value, max_value):
    """
    Generates a random number between the specified min_value and max_value.
    """
    return random.randint(min_value, max_value)