Random Number Generation Function

  • Share this:

Code introduction


This function takes two integer arguments, start and end, and returns a random integer within this range.


Technology Stack : Python Standard Library

Code Type : The type of code

Code Difficulty : Intermediate


                
                    
import random

def random_number_generator(start, end):
    """
    Generates a random number between the given start and end values.

    Args:
        start (int): The lower bound of the range.
        end (int): The upper bound of the range.

    Returns:
        int: A random number between start and end, inclusive.
    """
    return random.randint(start, end)