Docencia Autor

Distribución Beta

 /** Generate a random number from a beta random variable.
@param a First parameter of the Beta random variable.
@param b Second parameter of the Beta random variable.
@return A double.
*/

public static double beta(double a, double b)
{
    double try_x;
    double try_y;
    do
    {
        try_x = Math.pow(rand(),1/a);
        try_y = Math.pow(rand(),1/b);
    } while ((try_x + try_y) > 1);
    return try_x/(try_x + try_y);
}

Distribución Weibull

 /** Generate a random number from a Weibull random variable.
@param lambda First parameter of the Weibull random variable.
@param c Second parameter of the Weibull random variable.
@return A double.
*/

public static double weibull(double lambda, double k)
{
    double x = Math.pow(-Math.log(rand()),1/k)/lambda;
    return x;
}