Hello,
sorry, maybe I was not very clear in asking the question, the line
rng.GetBytes (randomData);
fills the 8 bytes (32bit) with random values
then
var randomInt = BitConverter.ToUInt32(randomData, 0);
it converts those random bytes to an unsigned int,
then
var mod = randomInt %...
Hi guys,
I'm looking for an algorithm to generate a safe random number like an OTP and I found this code on the web:
const int min = 100000;
const int max = 999999;
const int elemInRange = max - min + 1;
var randomData = new byte[4];
using var rng = new RNGCryptoServiceProvider()...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.