bundles / numpy 2.4.3 / numpy / random / _generator / Generator / standard_normal
cython_function_or_method
numpy.random._generator:Generator.standard_normal
Summary
Draw samples from a standard Normal distribution (mean=0, stdev=1).
Parameters
size: int or tuple of ints, optionalOutput shape. If the given shape is, e.g.,
(m, n, k), thenm * n * ksamples are drawn. Default is None, in which case a single value is returned.dtype: dtype, optionalDesired dtype of the result, only float64 and float32 are supported. Byteorder must be native. The default value is np.float64.
out: ndarray, optionalAlternative output array in which to place the result. If size is not None, it must have the same shape as the provided size and must match the type of the output values.
Returns
out: float or ndarrayA floating-point array of shape
sizeof drawn samples, or a single sample ifsizewas not specified.
Notes
For random samples from the normal distribution with mean mu and standard deviation sigma, use one of
mu + sigma * rng.standard_normal(size=...) rng.normal(mu, sigma, size=...)
Examples
rng = np.random.default_rng()
✓rng.standard_normal()
✗s = rng.standard_normal(8000)
✓s
✗s.shape s = rng.standard_normal(size=(3, 4, 2)) s.shape✓
3 + 2.5 * rng.standard_normal(size=(2, 4))
✗See also
- normal
Equivalent function with additional
locandscalearguments for setting the mean and standard deviation.
Aliases
-
numpy.random.Generator.standard_normal