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.
Default:
"device".
- Returns:
- outdpnp.ndarray
Drawn samples from the parameterized uniform distribution. Output array data type is the same as input dtype. If dtype is
None(the default),dpnp.float64type will be used if device supports it, ordpnp.float32otherwise.
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 asdpnp.int32,dpnp.float32,dpnp.float64orNone.See also
dpnp.random.RandomState.randintDiscrete uniform distribution, yielding integers.
dpnp.random.RandomState.random_integersDiscrete uniform distribution over the closed interval
[low, high].dpnp.random.RandomState.random_sampleFloats uniformly distributed over
[0, 1).dpnp.random.RandomState.randomAlias for
dpnp.random.RandomState.random_sample.dpnp.random.RandomState.randConvenience 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).
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]