Type text here
Code
1//
2/**//// 取得随机数
3///
4/// 随机数的长度
5///
6public static string getrandnum( int randnumlength )
7{
8system.random randnum = new system.random( unchecked( ( int ) datetime.now.ticks ) );
9stringbuilder sb = new stringbuilder( randnumlength );
10for ( int i = 0; i < randnumlength; i++ )
11{
12sb.append( randnum.next( 0, 9 ) );
13}
14return sb.tostring();
15}
16
17#endregion
18
1//
2/**//// 取得随机数
3///
4/// 随机数的长度
5///
6public static string getrandnum( int randnumlength )
7{
8system.random randnum = new system.random( unchecked( ( int ) datetime.now.ticks ) );
9stringbuilder sb = new stringbuilder( randnumlength );
10for ( int i = 0; i < randnumlength; i++ )
11{
12sb.append( randnum.next( 0, 9 ) );
13}
14return sb.tostring();
15}
16
17#endregion
18