dq.random.real
real(
key: PRNGKeyArray,
shape: int | tuple[int, ...],
*,
min: float = 0.0,
max: float = 1.0
) -> Array
Returns an array of uniformly distributed random real numbers.
Each element of the returned array is sampled uniformly in \([\text{min}, \text{max})\).
Parameters
-
key
–
A PRNG key used as the random key.
-
shape
(int or tuple of ints)
–
Shape of the returned array.
-
min
–
Minimum (inclusive) value.
-
max
–
Maximum (exclusive) value.
Returns
(array of shape (*shape)) Random real number array.
Examples
>>> key = jax.random.PRNGKey(42)
>>> dq.random.real(key, (2, 5), max=5.0)
Array([[2.444, 3.399, 3.081, 2.805, 2.253],
[2.929, 0.374, 3.876, 3.495, 4.093]], dtype=float32)