![]() |
VOOZH | about |
The uniform() method in Python generates a random floating-point number within a specified range. It belongs to the random module and is commonly used when a continuous random number is needed. For example, suppose we need to generate a random float number between 1 to 10
2.0014240090730393
Explanation: random.uniform(1,10) generates a random float number between 1 to 10 (inclusive).
random.uniform(l, u)
Parameters
Return Type: uniform(l, u) returns a float value.
Generating random float number using uniform() method.
6.706427492848576
Explanation:
.uniform() method can be used to generate random latitude and longitude coordinates, including negative floating-point values.
Random Location: 73.3285434510266 , -82.611145839544
Explanation: