string[] alpha = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
string current = "";
string[] newarr = new string [26];
Random rand = new Random();
for (int a = 0; a < 26 /*How many passwords*/; a++)
{
while (current.Length < 5 /*Length of passwords*/)
{
current = current + alpha[rand.Next(26)];
}
newarr[a] = current;
Console.WriteLine(newarr[a]);
}
The for loop is used to execute the code many times, thus providing many random strings, and the while loop is used to add a random digit to the password.