Python Numpy random()














































Python Numpy random()



Description
NumPy generally stands for Numerical Python and it is a general purpose array processing package.it always provides a high performance multidimensional array object. Numpy is usually for creating an array of n dimensions.

Method Name :numpy.random.random(size=None)
Description :The Python function random module functions as it depends on a pseudo-random number generator function random() in NumPy. It returns an array of specified shapes and fills it with random floats in the half-open interval [0.0, 1.0).

In this article, I will tell you about the parameter and its description
Parameter Name: size
Description : int or tuple of ints
If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

Return :The array of random floats in the interval [0.0, 1.0) or a single such random float if size not provided in the given output.

The first step would be to give syntax
command:
numpy.random.random(size=None)

Example :
Code :
# numpy.random.random() function # importing numpy import numpy as geek # output array out_arr = geek.random.random(size =(4,8)) print ("Output 2D Array filled with random floats : ", out_arr)

Output :
Example :
Code :

# numpy.random.random() function
# importing numpy import numpy as geek # output array out_arr = geek.random.random((2, 3, 2)) print ("Output 3D Array filled with random floats : ", out_arr)


Output :


Comments