/// <summary> /// Set Average and Variance Constructor. Throws an ArgumentOutOfRangeException /// exception if the variance is set to less than 0. /// </summary> /// <param name="Average">The average value of the returned random deviates.</param> /// <param name="Variance">The variance of the returned random deviates.</param> public cGaussianRandom(double Average, double Variance, cRandomBase RndGenerator) { if (RndGenerator == null) { throw new ArgumentNullException("RndGenerator"); } // throw an exception if the variance is less than or equal to 0 if (Variance <= 0) { ThrowVarianceException(); } // store the generator _rndGenerator = RndGenerator; // set the average and variance _average = Average; _variance = Variance; DeviateWaiting = false; }
// ************** Constructors ********************************************** /// <summary> /// Default constructor. Average = 1, Variance = 0.1 . /// </summary> /// <param name="RndGenerator">The random number generator to use</param> public cGaussianRandom(cRandomBase RndGenerator) : this(1.0, 0.1, RndGenerator) { }