dpnp.random.Generator.power

method

Generator.power(a, size=None, dtype=None, *, usm_type=None)[source]

Draw samples in [0, 1] from a power distribution with positive exponent a - 1.

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

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

The parameter of the distribution, positive.

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

Output shape. With None, the shape of a.

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.

usm_type{None, "device", "shared", "host"}, optional

The type of SYCL USM allocation for the output array.

Default: None, which means the USM type of the array parameters, or "device" when there are none.

Returns:
outdpnp.ndarray

The samples.

Raises:
ValueError

If a <= 0, for an a on the host.

Limitations

dtype and usm_type are not in NumPy's signature.

Examples

>>> import dpnp as np
>>> rng = np.random.default_rng(42)
>>> x = rng.power(3.0, 10**5)
>>> a = bool(((0 <= x) & (x <= 1)).all())
>>> b = bool(abs(x.mean() - 0.75) < 0.005)
>>> a, b
(True, True)