random_uniform

ivy.random_uniform(low=0.0, high=1.0, shape=None, dev_str='cpu', f=None)[source]

Draws 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.

Parameters
  • low (float) – Lower boundary of the output interval. All values generated will be greater than or equal to low. The default value is 0.

  • high (float) – Upper boundary of the output interval. All values generated will be less than high. The default value is 1.0.

  • shape – Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. If size is None (default), a single value is returned.

  • dev_str (str) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

Drawn samples from the parameterized uniform distribution.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty