Sunday, March 4, 2018

Number uniform() Method


Number uniform() Method in Python 3:

Description
The uniform() method returns a random float r, such that x is less than or equal to r and r is less than y.
Syntax
Following is the syntax for the uniform() method
uniform(x, y)

Note: This function is not accessible directly, so we need to import the uniform module and then we need to call this function using the random static object.
Parameters
· x - Sets the lower limit of the random float.
· y - Sets the upper limit of the random float.
Return Value
This method returns a floating point number r such that x <=r < y.
Example
The following example shows the usage of the uniform() method.



Let us run the above program. This will produce the following result-