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(); }

posted on 2009-04-15 10:42  风乔  阅读(367)  评论(0编辑  收藏  举报

导航