dpnp.random.Generator.standard_gamma

method

Generator.standard_gamma(shape, size=None, dtype=None, out=None, *, usm_type=None)[source]

Draw samples from a standard gamma distribution.

For full documentation refer to numpy.random.Generator.standard_gamma.

Parameters:
shape{float, array_like of floats, dpnp.ndarray, usm_ndarray}

The shape of the distribution, non-negative.

size{None, int, tuple of ints}, optional

Output shape. With None, the shape of shape.

Default: None.

dtype{None, dtype}, optional

The data type of the output, dpnp.float32 or dpnp.float64.

Default: None, which means the default floating-point type of the device.

out{None, dpnp.ndarray, usm_ndarray}, optional

A C-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 the USM type of the array parameters, or "device" when there are none.

Returns:
outdpnp.ndarray

The samples, or out when it is given.

Limitations

dtype defaults to the default floating-point type of the device, and usm_type is not in NumPy's signature.

Examples

>>> import dpnp as np
>>> rng = np.random.default_rng(42)
>>> x = rng.standard_gamma(2.0, 10**5)
>>> bool((x >= 0).all()), bool(abs(x.mean() - 2) < 0.03)
(True, True)