You can download this code by clicking the button below.
This code is now available for download.
Generate a random number between min_val and max_val.
Technology Stack : random
Code Type : Function
Code Difficulty : Intermediate
import random
def generate_random_number(min_val, max_val):
"""
Generate a random number between min_val and max_val.
Args:
min_val (int): The minimum value for the random number.
max_val (int): The maximum value for the random number.
Returns:
int: A random number between min_val and max_val.
"""
return random.randint(min_val, max_val)