Sunday, March 4, 2018

Number random() Method


Number random() Method in Python 3:

Description
The random() method returns a random floating point number in the range [0.0, 1.0].
Syntax
Following is the syntax for the random() method

import random
random( )

Note: This function is not accessible directly, so we need to import the random module and then we need to call this function using the random static object.
Parameters
NA
Return Value
This method returns a random float r, such that 0.0 <= r <= 1.0
Example
The following example shows the usage of the random() method.



When we run the above program, it produces the following result-