If you reduce the range to the nearest power of two then it's expected to only need 2 iterations on average. And if the number generator is guaranteed to generate every bit pattern eventually, then it's guaranteed to…
If you reduce the range to the nearest power of two then it's expected to only need 2 iterations on average. And if the number generator is guaranteed to generate every bit pattern eventually, then it's guaranteed to…