NumPy Pseudorandom Number Generation
Jump to navigation
Jump to search
Internal
Overview
The numpy.random
module supplements the built-in Python random
module with functions for efficiently generating whole arrays of sample values from many kinds of probability distributions.
np.random.standard_normal(10)
array([-0.31574999, -0.22620981, 0.78084923, -0.08299547, 0.02537403, -0.39786547, 0.69732466, -1.76220064, 0.26101635, -0.32073839])
np.random.standard_normal(size=(5, 3))
array([[ 6.26367775e-01, -7.97741988e-01, 1.53270456e-01], [ 1.66227193e+00, -1.16015757e-03, 9.65301493e-01], [-8.90605112e-01, 8.53983237e-01, -4.24828642e-01], [-4.60834281e-01, -1.36535277e+00, 1.89016088e+00], [-1.25755550e+00, 2.60187554e-01, 5.62396877e-01]])