用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > Net教程

asp.net 生成数字和字母组合的随机数

时间:2015-01-29  来源:互联网  作者:佚名
复制代码 代码如下:
private static char[] constant = { '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', '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' };

public string pxkt_GetCharFont(int strLength)
{
System.Text.StringBuilder newRandom = new System.Text.StringBuilder(62);
Random rd= new Random();
for(int i=0;i<strLength;i++)
{
newRandom.Append(constant[rd.Next(62)]);
}
return newRandom.ToString();
}
来顶一下
返回首页
返回首页
推荐资讯
Microsoft SQL Server 2005 Express 远程访问设置详述,100%成功篇 Microsoft SQL Server 2005 Expres概述  Microsoft SQL Server 2005 Express Edition是Micro
使用.NET命令行编译器编译项目(如ASP.NET、C#等) 使用.NET命令行编译器编译项目(如源程序最好有.csproj或.vbproj文件,没有的话,要花些时间调
相关文章
栏目更新
栏目热门