0 votes
1 view
in Python by (28.1k 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 (68.3k points)

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

import random 

random.uniform(0, 1)

...