zoukankan
html css js c++ java
创建随机字符串
1
/**/
///
<summary>
2
///
创建随机字符串
3
///
</summary>
4
///
<param name="codeCount">
随机数的位数
</param>
5
///
<returns></returns>
6
public
static
string
CreateRandomCode_Len54(
int
codeCount)
7
{
8
string
allChar
=
"
1,A,2,S,3,D,4,F,5,G,6,H,7,J,8,K,9,L,8,M,7,N,6,B,5,V,4,C,3,X,2,Z,1,P,9,Q,8,Z,7,W,6,I,5,E,4,U,3,R,2,Y,1,T,E,X,G,Q
"
;
9
string
[] allCharArray
=
allChar.Split(
'
,
'
);
10
string
randomCode
=
""
;
11
int
temp
=
-
1
;
12
13
Random rand
=
new
Random();
14
for
(
int
i
=
0
; i
<
codeCount; i
++
)
15
{
16
if
(temp
!=
-
1
)
17
{
18
rand
=
new
Random(i
*
temp
*
((
int
)DateTime.Now.Ticks));
19
}
20
int
t
=
rand.Next(
54
);
21
if
(temp
==
t)
22
{
23
return
CreateRandomCode_Len54(codeCount);
24
}
25
temp
=
t;
26
randomCode
+=
allCharArray[t];
27
}
28
return
randomCode;
29
}
查看全文
相关阅读:
C# .NET 微信开发-------当微信服务器推送消息时如何接收处理
P1991 无线通讯网[MST]
P2330 [SCOI2005]繁忙的都市【MST】
P1546 最短网络 Agri-Net【MST】
P3225 [HNOI2012]矿场搭建【割点 + 求点双 + 简单组合数】
P3119 [USACO15JAN]Grass Cownoisseur G [ Tarjan + 缩点 + 拓扑序 + dp + 最长路] [好题]
P2746 [USACO5.3]校园网Network of Schools [tarjan缩点]
P1196 [NOI2002]银河英雄传说 【带权并查集】
P1197 [JSOI2008]星球大战 [删边求连通块个数]
GPLT L2-004 这是二叉搜索树吗?
原文地址:https://www.cnblogs.com/ghd258/p/270438.html
最新文章
集合的全排列问题
hdu 1205
hdu2087
hdu1027
错排公式
hdu 1016
hdu 4300
poj 1704 Georgia and Bob
博弈——无向图删边
博弈——翻硬币游戏
热门文章
博弈总结
autocomplete用法
如何避免在EF自动生成的model中的DataAnnotation被覆盖掉
SVN 安装教程
未能加载文件或程序集“System.Web.Http.WebHost
MVC 事物
IList,List<T>转换为DataTable 常用收藏
C#将html table 导出成excel实例
微信网页授权验证
DataTable转Json
Copyright © 2011-2022 走看看