How to generate a random number in Python

To generate a random number in Python you can use the following snippet.

Sample Python

print random.randrange(0,10) #random number between 0 and 9

Please Share us:
Please rate this snippet

2 thoughts on “How to generate a random number in Python

Leave a Reply