This code snippet shows how to generate a random number in python using the in-build python method.
We can easily generate a random number in python using the in-built method
randint(a,b). This method is used to generate a random number within a range provided.
In order to use this
randint(a,b) method, you have to import random module as shown below,
# importing the random module import random print(random.randint(0,100))
In the above example, we have provided the range between 0 to 100. So the python will generate the random number between 0 to 100.