[转]随机生成密码
#region 随机生成密码
public static string RandomPassword(int pwdlen)
{
string tmpstr = "";
string pwdchars = "abcdefghijklmnopqrstuvwxyz0123456789";
int iRandNum;
Random rnd = new Random();
for (int i = 0; i < pwdlen; i++)
{
iRandNum = rnd.Next(pwdchars.Length);
tmpstr += pwdchars[iRandNum];
}
return tmpstr;
}
#endregion
public static string RandomPassword(int pwdlen)
{
string tmpstr = "";
string pwdchars = "abcdefghijklmnopqrstuvwxyz0123456789";
int iRandNum;
Random rnd = new Random();
for (int i = 0; i < pwdlen; i++)
{
iRandNum = rnd.Next(pwdchars.Length);
tmpstr += pwdchars[iRandNum];
}
return tmpstr;
}
#endregion
posted on 2008-05-21 10:58 freeliver54 阅读(920) 评论(2) 编辑 收藏 举报