PasswordCreator/frmCreatePassword.cs
/// <summary>
/// Gets a secured random number, using the Crypto Service Provider
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <returns>Secured Random Number</returns>
Gets a secured random number, using the Crypto Service Provider
Gets a secured random number using the Crypto Service Provider
private int GetSecureRandomNumber(int min, int max)
        {
            var rand = new byte[4];
            using (var rng = new RNGCryptoServiceProvider())
                rng.GetBytes(rand);
            var i = Math.Abs(BitConverter.ToInt32(rand, 0));
            return Convert.ToInt32(i % (max - min + 1) + min);
        }
private int GetSecureRandomNumber ( int min , int max ) { var rand = new byte [ 4 ] ; using ( var rng = new RNGCryptoServiceProvider ( ) ) rng . GetBytes ( rand ) ; var i = Math . Abs ( BitConverter . ToInt32 ( rand , 0 ) ) ; return Convert . ToInt32 ( i % ( max - min + 1 ) + min ) ; }
Gets a secured random number, using the Crypto Service Provider
Gets a secured random number using the Crypto Service Provider
Secured Random Number
Secured Random Number
min
int
None
max
int
None