Generate Random Passwords

Use the following method to generate random passwords.

private string GenerateRandomPassword(int minLength, int maxLength) {    StringBuilder randomPassword = new StringBuilder();    Random rand = new Random((int)DateTime.Now.Ticks);   int  randLength = rand.Next(minLength, maxLength);    for (int i = 0; i     {         int charint = 0;          while (charint == 0)              charint = rand.Next(48, 58);          randomPassword.Append((char)charint); } return randomPassword.ToString();   }}
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts