You can download this code by clicking the button below.
This code is now available for download.
This function takes two arguments, the first is the lower bound of the random number, and the second is the upper bound (default is 100), then returns a random integer within this range.
Technology Stack : Typer, random
Code Type : Function
Code Difficulty : Intermediate
from typer import Typer, Argument, Option
def generate_random_number(arg1: int, arg2: int = 100) -> int:
"""Generate a random number between arg1 and arg2.
Args:
arg1 (int): The lower bound of the range.
arg2 (int, optional): The upper bound of the range. Defaults to 100.
Returns:
int: A random number between arg1 and arg2.
"""
import random
return random.randint(arg1, arg2)