warp.randu ========== .. currentmodule:: warp._src.lang .. function:: randu(state: uint32) -> uint32 .. wp-function-tags:: :kernel: true :python: true :differentiable: false Generate a uniform random unsigned 32-bit integer in the range [0, 2^32). In a kernel, advances ``state`` in place, so successive calls return different values; called from the Python scope, it does not modify ``state``, so repeated calls with the same ``state`` return the same value (see :func:`rand_init`). .. function:: randu(state: uint32, low: uint32, high: uint32) -> uint32 :noindex: .. wp-function-tags:: :kernel: true :python: true :differentiable: false Generate a uniform random unsigned integer in the range [low, high). In a kernel, advances ``state`` in place, so successive calls return different values; called from the Python scope, it does not modify ``state``, so repeated calls with the same ``state`` return the same value (see :func:`rand_init`). Requires ``high > low``. Uses modulo reduction, so the distribution is slightly biased toward lower values for very large ranges.