Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I want a random number between 0 and 1, like 0.3452. I used random.randrange(0, 1) but it is always 0 for me. What should I do?

1 Answer

0 votes
by (106k points)

To generate a random number between 0 and 1 in Python you can use random.uniform:-

import random 

random.uniform(0, 1)

Related questions

0 votes
1 answer
0 votes
4 answers
asked Mar 31, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Feb 26, 2021 in Python by laddulakshana (16.4k points)

Browse Categories

...