method
Generator.standard_normal(size=None, dtype='d', out=None)
Draw samples from a standard Normal distribution (mean=0, stdev=1).
Parameters: |
|
---|---|
Returns: |
|
See also
normal
loc
and scale
arguments for setting the mean and standard deviation.For random samples from , use one of:
mu + sigma * gen.standard_normal(size=...) gen.normal(mu, sigma, size=...)
>>> rng = np.random.default_rng() >>> rng.standard_normal() 2.1923875335537315 #random
>>> s = rng.standard_normal(8000) >>> s array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, # random -0.38672696, -0.4685006 ]) # random >>> s.shape (8000,) >>> s = rng.standard_normal(size=(3, 4, 2)) >>> s.shape (3, 4, 2)
Two-by-four array of samples from :
>>> 3 + 2.5 * rng.standard_normal(size=(2, 4)) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/random/generated/numpy.random.Generator.standard_normal.html