/// <summary>
        ///   Generates a random vector of observations from the current distribution.
        /// </summary>
        ///
        /// <returns>
        ///   A random vector of observations drawn from this distribution.
        /// </returns>
        ///
        public double Generate()
        {
            uint jz = u.Next();
            uint iz = (jz & 255);

            if (jz < ke[iz])
            {
                return(jz * we[iz]);
            }

            for (; ;)
            {
                if (iz == 0)
                {
                    return(7.69711 - Math.Log(u.Generate()));
                }

                double x = jz * we[iz];

                if (fe[iz] + u.Generate() * (fe[iz - 1] - fe[iz]) < Math.Exp(-x))
                {
                    return(x);
                }

                jz = u.Next();
                iz = jz & 255;

                if (jz < ke[iz])
                {
                    return(jz * we[iz]);
                }
            }

            //throw new InvalidOperationException("Execution should not reach here.");
        }
        /// <summary>
        ///   Generates a random vector of observations from the current distribution.
        /// </summary>
        ///
        /// <returns>
        ///   A random vector of observations drawn from this distribution.
        /// </returns>
        ///
        public double Generate()
        {
            const double r = 3.442620;

            int  hz = (int)u.Next();
            uint iz = (uint)(hz & 127);

            if (Math.Abs(hz) < kn[iz])
            {
                return(hz * wn[iz]);
            }

            for (; ;)
            {
                double x;
                double y;

                if (iz == 0)
                {
                    for (; ;)
                    {
                        x = -0.2904764 * Math.Log(u.Generate());
                        y = -Math.Log(u.Generate());
                        if (x * x <= y + y)
                        {
                            break;
                        }
                    }

                    if (hz <= 0)
                    {
                        return(-r - x);
                    }
                    return(+r + x);
                }

                x = hz * wn[iz];

                if (fn[iz] + u.Generate() * (fn[iz - 1] - fn[iz]) < Math.Exp(-0.5 * x * x))
                {
                    return(x);
                }

                hz = (int)u.Next();
                iz = (uint)(hz & 127);

                if (Math.Abs(hz) < kn[iz])
                {
                    return(hz * wn[iz]);
                }
            }

            // throw new InvalidOperationException("Execution should not reach here.");
        }
 public double Generate()
 {
     return(u.Generate() * Length + Min);
 }