Home >>Python Random Module >Python Random uniform() Method

Python Random uniform() Method

Python Random uniform() Method

Python Random uniform() Method in python is used to returns a random float number between the two specified number, such that x is less than or equal to z and z is less than y.

Syntax:
random.uniform(a, b)

Parameter Values

Parameter Description
a It is Required. To specifying the lowest possible outcome of a number.
b It is Required. To specifying the highest possible outcome of a number.
Here is an Example of Python Random uniform() Method:

import random
print(random.uniform(15, 45))

Output:
15.66387266615463
Example 2:

import random
print(random.uniform(22, 37))

Output:
30.149477788063145

No Sidebar ads