Generate random numbers in python?

Submitted 3 years, 4 months ago
Ticket #372
Views 357
Language/Framework Python
Priority Medium
Status Closed

Is there any way to generate random numbers in python?

If there is a way ,what is it?

How many are there to generate?

Thanks in advance.......

Submitted on Mar 10, 21
add a comment

2 Answers


You can use randint method.

Eg., import random #import random module

variable = random.randint(give the range here)


Hope this works

Submitted 3 years, 4 months ago


This is what Jaanvi is saying:

import random

# set a range ---
# I've set a range between 0 and 100
# since last value is exclusive
rand_value = random.randint(0, 101)


You can find more about random here: python docs - random (

Submitted 3 years, 4 months ago

Latest Blogs