[0, bound).CryptoRandom.nextUintBound
uint nextUintBound(uint bound)Generates a random unsigned integer in the half-open interval [0, bound).
Uses rejection sampling to avoid modulo bias, ensuring a uniform distribution even when bound is not a power of two.
Parameters
bound | The exclusive upper bound; must not be 0 because the empty interval [0, 0) contains no value. |
Returns
A random integer in
Throws
CryptoException if
bound is 0.