Home >>Python Random Module >Python Random randint() Method

Python Random randint() Method

Python Random randint() Method

Python Random randint() Method in python is used to generate random number and returns an integer number from the specified range.

Syntax:
random.randint(start, stop)

Parameter Values

Parameter Description
start It is Required to specifying an integer at which position to start.
stop It is Required to specifying an integer at which position to end.
Here is an example of Python Random randint() Method:

import random
print(random.randint(5, 8))

Output:
7
Example 2:

import random
print(random.randint(8, 17))

Output:
14