public static string RandomPassword()
{
string _allowedChars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Random randNum = new Random();
char[] chars = new char[6];
int allowedCharCount = _allowedChars.Length;
for (int i = 0; i < 6; i++)
{
chars[i] = _allowedChars[(int)((_allowedChars.Length) * randNum.NextDouble())];
}
return new string(chars);
}This code snippet for generate random password using C# unction.
