标签:
1 public string GetRandStr() 2 { 3 System.Text.StringBuilder newRandom = new System.Text.StringBuilder(20); 4 Random rd = new Random(); 5 char[] dptSysID = { ‘0‘, ‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘, ‘6‘, ‘7‘, ‘8‘, ‘9‘, ‘a‘, ‘c‘, ‘d‘, ‘e‘, ‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘, ‘F‘ }; 6 for (int i = 0; i < 32; i++) 7 { 8 newRandom.Append(dptSysID[rd.Next(20)]); 9 } 10 string sysID = newRandom.ToString(); 11 return sysID.Substring(0, 8).ToString() + "-" 12 + sysID.Substring(8, 4).ToString() + "-" 13 + sysID.Substring(12,4).ToString() + "-" 14 + sysID.Substring(16,4).ToString() + "-" 15 + sysID.Substring(20,12).ToString(); 16 }
标签:
原文地址:http://www.cnblogs.com/mingsn/p/5939597.html