# Random Integer Generation In Python

Python is a dynamic programming language that provides different ways to generate random integers. Random integer generation means generating an integer value in a random manner which is unpredictable previously. Random integer generation is very useful for different use cases like the lottery, gaming, testing, etc. In this tutorial, we examine how to generate a random integer in Python.

## randint() Syntax

The `randint()` method is used to generate random integers with Python. The randint() method is provided via the `random` module.

``randint(START,STOP)``
• START is the starting number for the random integer. Generated random integer cannot be lthe ower than START number.
• STOP is the ending number for the random integer. Generated random integer cannot be higher than STOP number.

## Generate Random Integer Between 0 and 10

In the following example, we generate a random integer between 0 and 10. Every time we call the randint() method the generated integer will be different than the previous one.

``````import random

r = random.randint(0,10)``````

## Generate Random Integer Between 0 and 100

In the following example, we generate a random integer between 0 and 100. Every time we call the randint() method the generated integer will be different than the previous one.

``````import random

r = random.randint(0,100)``````

## Generate Random Integer For Specified Range

The randint() can be also used to generate a random integer between different ranges. In the following example, we generate a random integer between 38 and 86.

``````import random

r = random.randint(38,86)``````