Write a Python program to generate random float number.

How to generate a random float number in Python. Write a Python program to generate a random float number.

How to generate a random float number?

Random floating numbers can be generated using functions such as random() and uniform().

What is a random float?

Input: Random float from 0 to 100

Output: Randomly generated float is: 95.91307687603388

Algorithm to generate a random float number:

•       Import random
•       Assign a variable that will store the randomly generated floating number after calling the random() function.
•       Print that variable.

Python program to generate random float numbers.

Method 1: using random()

```import random
min = 2
max = 100
f = min + (max-min)*random.random()
print("Randomly generated floating number is:",f)```

Output: Printing the randomly generated floating numbers.

Method 2: using uniform()

```import random
print("Randomly generated floating numbers:")
for x in range(5):
print(random.random())```