dpnp.random.RandomState

class dpnp.random.RandomState(seed=None, device=None, sycl_queue=None)[source]

A container of a pseudo-random number generator on a SYCL device, with the legacy API of NumPy.

For full documentation refer to numpy.random.RandomState.

Parameters:
seed{None, int, array_like[ints], BitGenerator}, optional

A random seed to initialize the pseudo-random number generator, as for numpy.random.RandomState: an integer in [0, 2**32 - 1] or a 1-D array of such integers. With None, fresh entropy is pulled from the operating system. A dpnp.random.BitGenerator is used as the bit generator, on its own queue.

Default: None.

device{None, string, SyclDevice, SyclQueue, Device}, optional

An array API concept of device where the output array is created. device can be None, a oneAPI filter selector string, an instance of dpctl.SyclDevice corresponding to a non-partitioned SYCL device, an instance of dpctl.SyclQueue, or a dpnp.tensor.Device object returned by dpnp.ndarray.device.

Default: None.

sycl_queue{None, SyclQueue}, optional

A SYCL queue to use for output array allocation and copying. The sycl_queue can be passed as None (the default), which means to get the SYCL queue from device keyword if present or to use a default queue.

Default: None.

Limitations

Unless seed is a dpnp.random.BitGenerator, the bit generator is dpnp.random.Philox4x3210 rather than MT19937, so the values drawn differ from NumPy's, and the state is that of dpnp.random.Philox4x3210. device and sycl_queue cannot be given with a dpnp.random.BitGenerator. The values for a seed are those of dpnp.random.default_rng(seed) for the distributions whose checks agree, and depend on the device as described in the differences from NumPy.

Every method returns a dpnp.ndarray, zero-dimensional when size is None and the parameters are scalars, rather than a Python scalar. The floating-point methods take a dtype, which defaults to the default floating-point type of the device, and every method a usm_type, the type of USM allocation of the output, which by default is that of the array parameters, or "device". Parameters that are on the device are checked as NumPy checks all parameters, so a call with such parameters waits for the device, unlike the methods of dpnp.random.Generator.