tf.random.stateless_uniform

View source on GitHub

Outputs deterministic pseudorandom values from a uniform distribution.

tf.random.stateless_uniform(
    shape, seed, minval=0, maxval=None, dtype=tf.dtypes.float32, name=None
)

This is a stateless version of tf.random.uniform: if run twice with the same seeds, it will produce the same pseudorandom numbers. The output is consistent across multiple runs on the same hardware (and between CPU and GPU), but may change between versions of TensorFlow or on non-CPU/GPU hardware.

The generated values follow a uniform distribution in the range [minval, maxval). The lower bound minval is included in the range, while the upper bound maxval is excluded.

For floats, the default range is [0, 1). For ints, at least maxval must be specified explicitly.

In the integer case, the random integers are slightly biased unless maxval - minval is an exact power of two. The bias is small for values of maxval - minval significantly smaller than the range of the output (either 2**32 or 2**64).

Args:

Returns:

A tensor of the specified shape filled with random uniform values.

Raises: