标签:
public
static
string
RandCode(
int
N)
{
char
[] arrChar =
new
char
[] {
‘0‘
,
‘1‘
,
‘2‘
,
‘3‘
,
‘4‘
,
‘5‘
,
‘6‘
,
‘7‘
,
‘8‘
,
‘9‘
};
StringBuilder num =
new
StringBuilder();
Random rnd =
new
Random(Guid.NewGuid().GetHashCode());
for
(
int
i = 0; i < N; i++)
{
num.Append(arrChar[rnd.Next(0, arrChar.Length)].ToString());
}
return
num.ToString();
}
标签:
原文地址:http://www.cnblogs.com/weiaiy/p/5737794.html