for (int count = 0; count < 5; count++)
{
Random random = new Random(count);
//数字的数量:2个 or 3个
int numCount = random.Next(2, 3);
//字母的数量
int charCount = 12 - numCount;
string result = string.Empty;
for (int i = 0; i < charCount; i++)
{
//随机产生字母
result += (char)random.Next(65, 90);
}
for (int i = 0; i < numCount; i++)
{
//随机产生数字
int num = random.Next(0, 9);
//随机将数字插入到结果字符串中
int index = random.Next(0, result.Length - 1);
result = result.Insert(index, num.ToString());
}
Console.WriteLine(string.Format("[{0}]卡号:", count + 1));
Console.WriteLine(result);
}