Exemplo n.º 1
0
        public double NextRand()
        {
            var baseVariable = _mGenerator.NextRand();

            if (baseVariable < Ap)
            {
                return(A);
            }

            if (baseVariable < Bp)
            {
                return(B);
            }

            return(C);
        }
Exemplo n.º 2
0
        public double NextRand()
        {
            var baseVariable = _mGenerator.NextRand();

            if (baseVariable < (C - A) / Density)
            {
                var d = Math.Sqrt(baseVariable * (C - A) * Density);
                return(A + d);
            }

            if (baseVariable > 1 - (B - D) / Density)
            {
                var d = Math.Sqrt((1 - baseVariable) * (B - D) * Density);
                return(D - d);
            }

            return((baseVariable * Density + A + C) / 2);
        }