How to limit the Bcrypt library generated random numbers range?
Zsolt Kántor
80
Reputation points
Hello!
I'm using the Bcrypt library BCryptGenRandom function to generate random numbers.
The BCryptGenRandom function generates UCHARs with range 0-255.
I need a range of 1-50. I know I can use the formula: rand_num % (MAX_NUM + 1 - MIN_NUM) + MIN_NUM. But this formula is not as precise as eventually setting a range and generating random numbers with that range directly from the Windows API.
Is there a way to configure and set a range using the Bcrypt interface?
Sign in to answer