示例#1
0
        private double GenerateStandardNormalDistributedValue()
        {
            var u1 = U1Generator.NextDouble();
            var u2 = U2Generator.NextDouble();

            return(Math.Sqrt(-2 * Math.Log(u1)) * Math.Cos(2 * Math.PI * u2));
        }
示例#2
0
        private double GenerateExpotentialDistributedValue(double lambda = 1)
        {
            var u = U1Generator.NextDouble();

            return(Math.Log(1 - u) / -lambda);
        }