/// <summary>
/// 取得随机数
/// </summary>
/// <returns></returns>
private string GetRandom(int count)
{
string strAllChar = "0,1,2,3,4,5,6,7,8,9,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";
string []strchar=strAllChar.Split(',');
int temp = -1;
string strRandom="";
Random rand = new Random();
for (int i = 0; i < count; i++)
{
if (temp != -1)
{
rand = new Random(Guid.NewGuid().GetHashCode());
}
int x = rand.Next(36);
if (x == temp)
{
x = rand.Next(36);
}
temp = x;
strRandom+=strchar[temp];
}
return strRandom;
}
转载于:https://www.cnblogs.com/yangyi/archive/2008/01/15/1040023.html