标签:
/// <summary> /// 取随机字母 /// </summary> /// <param name="Count">字母个数</param> /// <returns>返回指定个数的随机字母串</returns> public static string GetRandomLetter(int Count) { String[] s = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" }; StringBuilder stb = new StringBuilder(); Random rd = new Random(Guid.NewGuid().GetHashCode()); for (int i = 0; i < Count; i++) { stb.Append(s[rd.Next(26)]); } return stb.ToString(); }
标签:
原文地址:http://www.cnblogs.com/xiaomihu/p/5823997.html