2

Can random float numbers be generated through using math module?

spartan
  • 25
  • 1
  • 6

1 Answers1

3

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
  • 425
  • 5
  • 10