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# Apache Thrift Demo
C#指针使用demo
C#中指针使用总结
fastjson之JSONObject、JSONArray
fastjson使用
ObjectMapper使用
ObjectMapper将json转对象报错处理
rabbitmq-channel方法介绍
rabbitmq不同模式的交换机使用
activemq总结
原文地址:https://www.cnblogs.com/ghd258/p/270438.html
最新文章
int abs(int number)函数有感: 求补码和通过补码求对应的整数 C++(增加:数字的二进制表示中1的个数)
LeetCode: 338. Counting Bits
vector--C++ STL 学习
LeetCode 53. Maximum Subarray
ASP.NET MVC Controller 编程所涉及到的常用属性成员
jQuery之$.support.xxx
wampserver2.5 在 Win7 64位下的相关配置备忘
ASP.NET MVC 之各种jQuery提交模式实例
ASP.NET MVC Razor语法及实例
ASP.NET MVC之"重定向/页面跳转"(关键词RedirectToAction,Redirect)
热门文章
ASP.NET MVC知识点目录
JavsScript中JSON相关
ASP.NET MVC 页面模块编程语法小结
volatile 错误示范做线程同步 demo
C/C++ Volatile关键词深度剖析
C# 基础回顾: volatile 关键字
volatile 关键词
C#线程池 ThreadPool
EventWaitHandle 第一课
thrift 安装
Copyright © 2011-2022 走看看