net生成12位随机数
public static string RandCode(int n)
{
char[] arrChar = new char[]{
'0','1','2','3','4','5','6','7','8','9' };
StringBuilder num = new StringBuilder();
Random rnd = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < n; i++)
{
num.Append(arrChar[rnd.Next(0, arrChar.Length)].ToString());
}
return num.ToString();
}