Below for you to share an article based on NUMPY.RANDOM.RANDN () and Rand () a detailed explanation, with a good reference value, I hope to be helpful to everyone. Come and see it together.
There are some commonly used functions for generating random numbers in numpy , and Randn () and Rand () belong to this.
Numpy.random.randn (D0, D1, ..., dn) returns one or more sample values from a standard normal distribution.
A random sample of Numpy.random.rand (D0, D1, ..., dn) is located in [0, 1].
Import NumPy as NP arr1 = NP.RANDOM.RANDN (2,4) print (arr1) print (' **************************************************** ') arr2 = Np.random.rand (2,4) print (ARR2)
Results:
[[-1.03021018 0.5197033 0.52117459-0.70102661] [0.98268569 1.21940697-1.095241-0.38161758]]*********************** [[0.19947349 0.05282713 0.56704222 0.45479972] [0.28827103 0.1643551 0.30486786 0.56386943]]