BExISMigration.UserMigration.randomPassword C# (CSharp) Method

randomPassword() private method

private randomPassword ( Random &gen ) : string
gen System.Random
return string
        private string randomPassword(ref Random gen)
        {
            int passwordLength = 8;
            string newPassword = "";
            string allowedChars = "";

            allowedChars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            allowedChars += "abcdefghijklmnopqrstuvwxyz";
            allowedChars += "0123456789";
            allowedChars += "-_.:,;!?=";

            //Random gen = new Random();
            for (int i = 1; i <= passwordLength; i++)
            {
                newPassword += allowedChars[gen.Next(0, allowedChars.Length)];
            }

            return newPassword;
        }