public double NextGaussian(double mean, double sd) { var uni1 = SiriusRandomProvider.GetRandom(); var uni2 = SiriusRandomProvider.GetRandom(); Next = (mean + sd * (Math.Sqrt(-2 * Math.Log(uni1.NextDouble()))) * Math.Sin(2 * Math.PI * uni2.NextDouble())); return(Next); }
public GaussianDistribution(double mean, double sd) { Mean = mean; SD = sd; var uni1 = SiriusRandomProvider.GetRandom(); var uni2 = SiriusRandomProvider.GetRandom(); Next = (mean + sd * (Math.Sqrt(-2 * Math.Log(uni1.NextDouble()))) * Math.Sin(2 * Math.PI * uni2.NextDouble())); }