How can I generate a random real number between 100 and 200 using the random function in Python? The default range is 0-1
Asked
Active
Viewed 3,405 times
-3
-
Have you [checked the section on real values](https://docs.python.org/3/library/random.html#real-valued-distributions) in the `random` documentation yet? – Martijn Pieters Sep 24 '18 at 12:29
-
@Biohacker x100 +100 – Guimoute Sep 24 '18 at 12:30
-
@Guimoute Thanks, works well. – Biohacker Sep 24 '18 at 13:39
1 Answers
0
Simply use the random library
import random
print(random.randrange(100,200))

Anuja Barve
- 300
- 1
- 4
- 23
-
Thank you for the reply. In fact, I wanted a function that could generate either an integer or a float. Thus, a real number in general. – Biohacker Sep 24 '18 at 13:11