Python program to generate a random number
In python, there are a set of functions that are used to manipulate random numbers.
They are generally used in games, lottery, any other application requiring random numbers. Here, we will import the file of random in order to perform its operation such as:
rd.random(), rd.randint(1,100), rd.randrange(1,100), etc.
- Import the file name random using python.
- Print the different random functions.
import random as rd
print(rd.random()) #gives a random float number print(rd.randint(1,100)) #gives a random integer between these 2 numbers
print(rd.randrange(1,100)) #gives a random integer in this range
print(rd.choice([1,2,3,4,5,6,7])) #gives a random integer in these choices
0.3583190240354166 89 57 4