1 private int rep = 0; 2 public string GenerateCheckCode(int codeCount) 3 { 4 string str = string.Empty; 5 long num2 = DateTime.Now.Ticks + this.rep; 6 this.rep++; 7 Random random = new Random(((int)(((ulong)num2) & 0xffffffffL)) | ((int)(num2 >> this.rep))); 8 for (int i = 0; i < codeCount; i++) 9 { 10 char ch; 11 int num = random.Next(); 12 if ((num % 2) == 0) 13 { 14 ch = (char)(0x30 + ((ushort)(num % 10))); 15 } 16 else 17 { 18 ch = (char)(0x41 + ((ushort)(num % 0x1a))); 19 } 20 str = str + ch.ToString(); 21 } 22 return str; 23 }