惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
S
Security Affairs
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
雷峰网
雷峰网
Recent Announcements
Recent Announcements
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
博客园_首页
The Cloudflare Blog
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
S
SegmentFault 最新的问题
P
Proofpoint News Feed
Y
Y Combinator Blog
Jina AI
Jina AI
博客园 - 聂微东
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
F
Full Disclosure
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
T
Tailwind CSS Blog
J
Java Code Geeks
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 三生石上(FineUI控件)
W
WeLiveSecurity
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
宝玉的分享
宝玉的分享
IT之家
IT之家
Hacker News: Ask HN
Hacker News: Ask HN
The Register - Security
The Register - Security
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs

博客园 - tronic

进度条HTML - tronic - 博客园 linq操作datatable - tronic - 博客园 ASP.NET中漂亮的弹出对话框 C# 操作数据库,数据库表 实现MSN弹出窗口特效示例代码 - tronic - 博客园 加密和解密运算代码 - tronic - 博客园 在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的节是错误的 CreateUserWizard的控件插得很深 - tronic - 博客园 保留一下遍历页面所有控件的方法 C#中web.config文件详解 招聘 ASP.NET程序员 任何调用的结束,一定要Dispose 可视化操作常见错误的解决方法 使用WebClient自动填写并提交ASP.NET页面表单 任何时候使用POST数据都要URLENCODE 获取图片地址代码(严格按HTML编写的图片地址) 正则表达式获取内容中的数字 Asp.Net性能优化. Asp.Net细节性问题技巧精萃
生成n位不同的验证码
tronic · 2007-04-17 · via 博客园 - tronic

public string RandomNum(int n) //
{
 string strchar = "0,1,2,3,4,5,6,7,8,9" ;
 string[] VcArray = strchar.Split(',') ;
 string  VNum = "" ;//由于字符串很短,就不用StringBuilder了
 int temp = -1 ;    //记录上次随机数值,尽量避免产生几个一样的随

机数
 //采用一个简单的算法以保证生成随机数的不同
 Random rand =new Random();
 for ( int i = 1 ; i < n+1 ; i++ )
 {   
  if ( temp != -1)
  {
   rand =new Random(i*temp*unchecked((int)

DateTime.Now.Ticks));
  }   
  //int t =  rand.Next(35) ;
  int t=rand.Next(10);
  if (temp != -1 && temp == t)
  {
   return RndNum( n);
  }
  temp = t  ;
  VNum += VcArray[t];
  }
 return VNum ;//返回生成的随机数
}