using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; namespace Calculation { public static class RandomStatic { //产生[0,1)的随机小数 public static double ProduceDblRandom() { Random r = new Random(Guid.NewGuid().GetHashCode());//使用Guid的哈希值做种子 return r.NextDouble(); } //产生制定范围内的随机整数 public static int ProduceIntRandom(int minValue, int maxValue) { Random r = new Random(Guid.NewGuid().GetHashCode()); return r.Next(minValue, maxValue + 1); } } }