dpnp.random.Generator.standard_normal¶
method
- Generator.standard_normal(size=None, dtype=None, out=None, *, usm_type=None)[source]¶
Draw samples from a standard normal distribution.
For full documentation refer to
numpy.random.Generator.standard_normal.- Parameters:
- size{None, int, tuple of ints}, optional
Output shape. With
None, a zero-dimensional array is returned.Default:
None.- dtype{None, dtype}, optional
The data type of the output,
dpnp.float32ordpnp.float64.Default:
None, which means the default floating-point type of the device.- out{None, dpnp.ndarray, usm_ndarray}, optional
A C- or F-contiguous array to fill, of the data type dtype and on the SYCL queue of the generator. If size is given as well, it must be the shape of out.
Default:
None.- usm_type{None, "device", "shared", "host"}, optional
The type of SYCL USM allocation for the output array. Ignored when out is given.
Default:
None, which means"device".
- Returns:
- outdpnp.ndarray
The samples, or out when it is given.
Limitations
dtype and usm_type are not in NumPy's signature. The Box-Muller transform is used rather than NumPy's ziggurat, so the magnitude of the samples is bounded: by about 6.8 in float32, and 8.6 in float64.
Examples
>>> import dpnp as np >>> rng = np.random.default_rng(42) >>> x = rng.standard_normal(10**6) >>> bool(abs(x.mean()) < 0.01), bool(abs(x.std() - 1) < 0.01) (True, True)