All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
用PHPINFO来实现PHP的配置统计过程_php资料_编程技术
用Php模拟asp.net的页面模型_php资料_编程技术
.NET,2.0,中的自定义配置处理_[Asp.Net教程]
PHP实例:PHP取GB2312编码字符串首字母的方法_php资料_编程技术
经典正则表达式,(收藏整理)_JavaScript技术_编程技术
5款纯div+css制作的弹出菜单(标准且无js)_[Html教程]_0
ASP.NET2.0:使用GridView绑定XmlDocument对象_[Asp.Net教程]
SQL2000系统表的应用_[SQL,Server教程]
(asp.net+Access)图片上传到数据库同时显示_[Asp.Net教程]
Asp.Net实例:为DataGrid添加自动编号功能_[Asp.Net教程]
Reading number is top 10 pictures
中国女孩大胆自拍,显露完美身材4
The little girl with long hair3
英雄联盟超神十连杀截图
Gang rape
Compared GDP and per capita income in China for 40 years
来几张有特色的图片
The mother was a stay-at-home children too tired took three baby suicide
30 beautiful school beauty4
The money of more than 100 countries and regions4
中国女孩大胆自拍,显露完美身材
Download software ranking
Eclipse-CALMSANNY (second edition)
虚拟机汉化软件
Unix video tutorial20
Red cliff
美女写真1
WebService在.NET中的实战应用教学视频 → 第2集
linux安装大全
linux初级教程
Boxer Classic video3
Eclipse 4.2.2 For Win32
delv published in(发表于) 2014/1/24 9:03:11 Edit(编辑)
Asp.NET,生成随机码基类(随机字母,随机数字,随机字母+数字,)_[Asp.Net教程]

Asp.NET,生成随机码基类(随机字母,随机数字,随机字母+数字,)_[Asp.Net教程]

Asp.NET 生成随机码基类(随机字母,随机数字,随机字母+数字 )_[Asp.Net教程]

/############################################
版权声明:
文章内容为本站编辑,创作.你可以任意转载、发布、使用但请务必以明文标注文章原始出处及本声明
http://www.opent.cn 作者:浪淘沙
############################################/

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;


namespace EC
{
///


/// 随机函数
///

public class RandomObject
{

#region 数字随机数
///
/// 数字随机数
///

/// 生成长度
///
public static string RandNum(int n)
{
char[] arrChar = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
StringBuilder num = new StringBuilder();

Random rnd = new Random(DateTime.Now.Millisecond);

for (int i = 0; i < n; i++)
{
num.Append(arrChar[rnd.Next(0, 9)].ToString());

}

return num.ToString();
}
#endregion

#region 数字和字母随机数
///
/// 数字和字母随机数
///

/// 生成长度
///
public static string RandCode(int n)
{
char[] arrChar = new char[]{
'a','b','d','c','e','f','g','h','i','j','k','l','m','n','p','r','q','s','t','u','v','w','z','y','x',
'0','1','2','3','4','5','6','7','8','9',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','Q','P','R','T','S','V','U','W','X','Y','Z'
};

StringBuilder num = new StringBuilder();

Random rnd = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < n; i++)
{
num.Append(arrChar[rnd.Next(0, arrChar.Length)].ToString());

}

return num.ToString();
}
#endregion

#region 字母随机数
///
/// 字母随机数
///

/// 生成长度
///
public static string RandLetter(int n)
{
char[] arrChar = new char[]{
'a','b','d','c','e','f','g','h','i','j','k','l','m','n','p','r','q','s','t','u','v','w','z','y','x',
'_',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','Q','P','R','T','S','V','U','W','X','Y','Z'
};

StringBuilder num = new StringBuilder();

Random rnd = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < n; i++)
{
num.Append(arrChar[rnd.Next(0, arrChar.Length)].ToString());

}

return num.ToString();
}
#endregion

#region 日期随机函数
///
/// 日期随机函数
///

/// 长度
///
public static string DateRndName(Random ra)
{
DateTime d = DateTime.Now;
string s = null, y, m, dd, h, mm, ss;
y = d.Year.ToString();
m = d.Month.ToString();
if (m.Length < 2) m = "0" + m;
dd = d.Day.ToString();
if (dd.Length < 2) dd = "0" + dd;
h = d.Hour.ToString();
if (h.Length < 2) h = "0" + h;
mm = d.Minute.ToString();
if (mm.Length < 2) mm = "0" + mm;
ss = d.Second.ToString();
if (ss.Length < 2) ss = "0" + ss;
s += y + m + dd + h + mm + ss;
s += ra.Next(100, 999).ToString();
return s;
}
#endregion

#region 生成GUID
///
/// 生成GUID
///

///
public static string GetGuid()
{
System.Guid g = System.Guid.NewGuid();
return g.ToString();
}
#endregion
}
}

Asp.NET 生成随机码基类(随机字母,随机数字,随机字母+数字 )


Asp.Net教程:/HtmlData/Program/Asp.Net/







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.