2

Can random float numbers be generated through using math module?

sparktus
  • 25
  • 5

1 Answers1

2

From my experience dealing with python, I can only say that the random function can help in generating random float numbers. Take the example below;

import random

# Random float number between range 15.5 to 80.5
print(random.uniform(15.5, 80.5))

# between 10 and 100
print(random.uniform(10, 100))

The random.uniform() function returns a random floating-point number between a given range in Python

The two sets of code generates random float numbers. You can try experimenting with it to give you what you want.

DrosnickX
  • 387
  • 4
  • 9