0 votes
1 view
in Python by (47.8k 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 (107k 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
1 answer
asked Sep 26, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
asked Sep 25, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
asked Sep 17, 2019 in Python by Sammy (47.8k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...