About Lesson
uniform() Method
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 |
Example
Return a random number between, and included, 20 and 60:
import random
print(random.uniform(20, 60))
Output:
53.29