dpnp.random.Generator

class dpnp.random.Generator(bit_generator)[source]

A container for the bit generator and the distribution samplers.

The analogue of numpy.random.Generator, drawing all samples on the SYCL queue of its bit generator. Use dpnp.random.default_rng() to create one.

For full documentation refer to numpy.random.Generator.

Parameters:
bit_generatorBitGenerator

The bit generator, such as dpnp.random.Philox4x3210 or dpnp.random.PCG64DXSM.

Limitations

Every method returns a dpnp.ndarray, zero-dimensional when size is None and the parameters are scalars, rather than a Python scalar. The methods take a usm_type keyword, and the floating-point ones a dtype keyword, as in CuPy, whose default is the default floating-point type of the device.

Parameters on the host (scalars, lists and NumPy arrays) are checked as in NumPy. Parameters on the device are not, since that would wait for the device. Invalid ones give undefined values, such as NaN or the smallest int64, but never make the kernels loop without end or access memory out of bounds.

The discrete distributions return int64 values, and compute in double precision on devices supporting it, and in single precision otherwise. On the latter, the samples for very large parameters, such as a Poisson lam beyond about 1e7, are less accurate than NumPy's.