using System; using System.Collections.Generic; using System.Linq; using System.Text; public class RandomHelper { /// /// 随机种子 /// private int mSeed = 0; /// /// 随机对象 /// private Random mRandom = null; /// /// 随机数队列 /// //private Queue mQueue = new Queue(); /// /// 构造 /// public RandomHelper() { this.mSeed = (int)DateTime.Now.Ticks & 0x0000FFFF; this.mRandom = new Random(this.mSeed); } /// /// 在指定范围内给予随机数 /// /// 最小值 /// 最大值 /// 随机值 public int Range(int min, int max) { return this.mRandom.Next(min, max); } /// /// 获取随机浮点数,范围(0-1.0) /// /// 随机浮点数 public double Range() { return this.mRandom.NextDouble(); } }