/// <summary>
/// 生成随机字符串
/// </summary>
private class RandomStringGenerator
{
static readonly Random r = new Random();
const string _chars = "0123456789";
public static string GetRandomString()
{
char[] buffer = new char[5];
for (int i = 0; i < 5; i++)
{
buffer[i] = _chars[r.Next(_chars.Length)];
}
return new string(buffer);
}
}
C#生成随机字符串
最新推荐文章于 2024-01-17 09:23:26 发布