///
<summary>
/// 产生随机数
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public static string GenerateRandomString( int length)
{
System.Text.StringBuilder MyStringBuilder = new System.Text.StringBuilder();
char [] chars = " 0123456789 " .ToCharArray();
int index;
Random rnd = new Random();
for ( int i = 0 ; i < length; i ++ )
{
index = rnd.Next(chars.Length);
MyStringBuilder.Append(chars[index].ToString());
}
return MyStringBuilder.ToString();
}
/// 产生随机数
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public static string GenerateRandomString( int length)
{
System.Text.StringBuilder MyStringBuilder = new System.Text.StringBuilder();
char [] chars = " 0123456789 " .ToCharArray();
int index;
Random rnd = new Random();
for ( int i = 0 ; i < length; i ++ )
{
index = rnd.Next(chars.Length);
MyStringBuilder.Append(chars[index].ToString());
}
return MyStringBuilder.ToString();
}