jax.random.uniform

Contents

jax.random.uniform#

jax.random.uniform(key, shape=(), dtype=<class 'float'>, minval=0.0, maxval=1.0)[source]#

Sample uniform random values in [minval, maxval) with given shape/dtype.

Parameters:
  • key (Array | ndarray | bool_ | number | bool | int | float | complex) – a PRNG key used as the random key.

  • shape (Sequence[int] | NamedShape) – optional, a tuple of nonnegative integers representing the result shape. Default ().

  • dtype (str | type[Any] | dtype | SupportsDType) – optional, a float dtype for the returned values (default float64 if jax_enable_x64 is true, otherwise float32).

  • minval (Array | ndarray | bool_ | number | bool | int | float | complex) – optional, a minimum (inclusive) value broadcast-compatible with shape for the range (default 0).

  • maxval (Array | ndarray | bool_ | number | bool | int | float | complex) – optional, a maximum (exclusive) value broadcast-compatible with shape for the range (default 1).

Returns:

A random array with the specified shape and dtype.

Return type:

Array