numpy.random.random() function with no input parameter | Linear Algebra using Python

Linear Algebra using Python | numpy.random.random() function with no input parameter: Here, we are going to learn about the numpy.random.random() function with no input parameter in Python?
Submitted by Anuj Singh, on May 22, 2020

Numpy is the library of function that helps to construct or manipulate matrices and vectors. The function numpy.random.random() is a function used for generating a random value between 0 and 1. This function has a huge application in machine learning and probability.

Syntax:

    random_value = numpy.random.random()

Input parameter(s): None.

Python code to demonstrate example of numpy.random.random() function

# Linear Algebra Learning Sequence 
# numpy.random.random() function to 
# get a random value

import numpy as np

print("\n--Printing a set of 15 random numbers with range 0 to 1--\n")

for i in range(15):
    print('Random Value',i+1,' :', np.random.random())

Output:

--Printing a set of 15 random numbers with range 0 to 1--

Random Value 1  : 0.706190689849706
Random Value 2  : 0.04614551250974097
Random Value 3  : 0.13004947242111353
Random Value 4  : 0.11031031469193309
Random Value 5  : 0.6427980624326431
Random Value 6  : 0.3013274621110915
Random Value 7  : 0.40619616687836857
Random Value 8  : 0.6804665240893712
Random Value 9  : 0.7663192165667464
Random Value 10  : 0.5489087055243076
Random Value 11  : 0.8196093405417416
Random Value 12  : 0.8370083293699818
Random Value 13  : 0.1945776676106037
Random Value 14  : 0.2760592260482946
Random Value 15  : 0.31670529527628843



Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.