dpnp.random.RandomState.uniform

method

RandomState.uniform(low=0.0, high=1.0, size=None, dtype=None, usm_type='device')[source]

Draw samples from a uniform distribution.

Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.

For full documentation refer to numpy.random.RandomState.uniform.

Parameters:

usm_type ({"device", "shared", "host"}, optional) -- The type of SYCL USM allocation for the output array.

Returns:

out -- Drawn samples from the parameterized uniform distribution. Output array data type is the same as input dtype. If dtype is None (the default), dpnp.float64 type will be used if device supports it, or dpnp.float32 otherwise.

Return type:

dpnp.ndarray

Limitations

Parameters low and high are supported as a scalar. Otherwise, numpy.random.RandomState.uniform(low, high, size) samples are drawn. Parameter dtype is supported only as dpnp.int32, dpnp.float32, dpnp.float64 or None.

Examples

>>> low, high = 1.23, 10.54    # low and high
>>> s = dpnp.random.RandomState().uniform(low, high, 5)
>>> print(s)
[2.48093112 6.52928804 9.1196081  8.6990877  8.34074171]

See also

dpnp.random.RandomState.randint

Discrete uniform distribution, yielding integers.

dpnp.random.RandomState.random_integers

Discrete uniform distribution over the closed interval [low, high].

dpnp.random.RandomState.random_sample

Floats uniformly distributed over [0, 1).

dpnp.random.RandomState.random

Alias for dpnp.random.RandomState.random_sample.

dpnp.random.RandomState.rand

Convenience function that accepts dimensions as input, e.g., rand(2, 2) would generate a 2-by-2 array of floats, uniformly distributed over [0, 1).