Python Random uniform() Method
Example
Return a random number between, and included, 20 and 60:
import random
print(random.uniform(20, 60))
Try it Yourself »
Definition and Usage
The uniform()
method returns a random
floating number between the two specified numbers (both included).
Syntax
random.uniform(a, b)
Parameter Values
Parameter | Description |
---|---|
a | Required. A number specifying the lowest possible outcome |
b | Required. A number specifying the highest possible outcome |