You can download this code by clicking the button below.
This code is now available for download.
This function generates a random integer within a specified range.
Technology Stack : random.randint() function
Code Type : Function
Code Difficulty : Intermediate
import os
import re
import sys
import time
import json
import math
import random
def generate_random_number(min_value, max_value):
"""生成指定范围内的随机数
Args:
min_value (int): 随机数的最小值
max_value (int): 随机数的最大值
Returns:
int: 生成的随机数
"""
return random.randint(min_value, max_value)