Returns a uniformly distributed integer in the closed interval
[lo, hi]. Both bounds must be safe integers and lo <= hi.
hi - lo + 1 must also be a safe integer.
The sampler reads the fewest bytes necessary to either match the
requested range or cover at least two full repetitions of it,
discarding draws beyond the last full repetition to eliminate
modulo bias. The per-draw reject probability p never exceeds
0.5, and consecutive draws are independent, so the probability
of needing more than k draws is p ** k and the probability
of an unbounded reject sequence is 0 in the limit. The expected
number of draws per call is 1 / (1 - p), bounded by 2.
Returns a uniformly distributed integer in the closed interval
[lo, hi]. Both bounds must be safe integers andlo <= hi.hi - lo + 1must also be a safe integer.The sampler reads the fewest bytes necessary to either match the requested range or cover at least two full repetitions of it, discarding draws beyond the last full repetition to eliminate modulo bias. The per-draw reject probability
pnever exceeds 0.5, and consecutive draws are independent, so the probability of needing more thankdraws isp ** kand the probability of an unbounded reject sequence is 0 in the limit. The expected number of draws per call is1 / (1 - p), bounded by 2.