

In fact, I wish I could go back in time and unpublish it! While this version is definitely better, there is still room for improvement.
.NET RANDOM PASSWORD GENERATOR CODE
Due to many factors, that code was rushed and proved to be inefficient. " previous version of this class was intended for use in a much larger project (I will be publishing articles on various components of that project soon.). Private char pwdCharArray = " abcdefghijklmnopqrstuvwxyzABCDEFG" + This.maxSize = PasswordGenerator.DefaultMaximum This.minSize = PasswordGenerator.DefaultMinimum Generate random characters char lastCharacter, nextCharacter StringBuilder pwdBuffer = new StringBuilder() Pick random length between minimum and maximum int pwdLength = GetCryptographicRandomNumber( this.Minimum, PwdCharArray.GetLowerBound( 0), upperBound) Ĭhar randomChar = pwdCharArray Int randomCharPosition = GetCryptographicRandomNumber(

UpperBound = PasswordGenerator.UBoundDigit Int upperBound = pwdCharArray.GetUpperBound( 0) Return ( int)(urndnum % (uBound-lBound)) + lBound Assumes lBound >= 0 & lBound = lBound and = xcludeRndBase)

Protected int GetCryptographicRandomNumber( int lBound, int uBound)
.NET RANDOM PASSWORD GENERATOR HOW TO
This article illustrates how to create a very simple password generator using C#.
