Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
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

error: Content is protected !!