/// <summary>
/// 生成随机数
/// </summary>
/// <param name="minValue">最小值</param>
/// <param name="maxValue">最大值</param>
/// <returns></returns>
private int getRandom(int minValue, int maxValue)
{
Random ri = new Random(unchecked((int)DateTime.Now.Ticks));
int k = ri.Next(minValue, maxValue);
return k;
}
//想定一个三位的随机数:string ThreeRandom=this.getRandom(100,999).Tostring();
//类似的,四位随机数:string FourRandom=this.getRandom(1000,9999).Tostring();
生成任意位数的随机数
最新推荐文章于 2023-08-10 17:23:39 发布