Python Random is an inbuilt number module that can generate pseudo-random numbers. The function random() generates the random number between 0 and 1 [0, 0.1 … 1]. Numbers generated with the random module are not truly random, but they are enough random for most purposes.

Python Random Number Module

Python random module has various functions to accomplish all the above tasks. We need to import the random module in your program, and you are good to go. We will see how to use the random module functions in the following section of an article. See the following statement to import the random module.

import random

If we want to generate a random number in Python, the randint() function is used. First, we import the module and then we can use the module’s randint() function to generate the random number. See the below code example.

## app.py

from random import *
print(random())

#python #python random #randint

Python Random Number Module Tutorial With Example
3.40 GEEK