dpnp.random.default_rng

dpnp.random.default_rng(seed=None, *, device=None, sycl_queue=None)[source]

Construct a new dpnp.random.Generator with the default bit generator, dpnp.random.Philox4x3210.

For full documentation refer to numpy.random.default_rng.

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

The entropy to seed the bit generator with. A dpnp.random.BitGenerator is wrapped in a new generator, and a dpnp.random.Generator is returned unaltered.

Default: None.

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

An array API concept of device where the samples are drawn and allocated. Ignored when seed is a bit generator or a generator.

Default: None.

sycl_queue{None, SyclQueue}, optional

A SYCL queue to draw samples on. Ignored when seed is a bit generator or a generator.

Default: None.

Returns:
outGenerator

The initialized generator.

Limitations

NumPy's default bit generator is PCG64, so the same seed gives different values.

Examples

>>> import dpnp as np
>>> rng = np.random.default_rng(12345)
>>> x = rng.random(3)
>>> x.shape, x.device == rng.bit_generator.sycl_queue.sycl_device
((3,), True)