package umontreal.iro.lecuyer.randvar;
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;


/**
 * This class implements random variate generators for 
 * the fatigue life distribution with location
 * parameter μ, scale parameter β and shape
 * parameter γ.
 * The density function of this distribution is
 * 
 * 

*
* f (x) = [(((x - μ)/β)1/2 + (β/(x - μ))1/2)/(2γ(x - μ))]φ((((x - μ)/β)1/2 - (β/(x - μ))1/2)/γ),        x > μ *

* where φ is the probability density of the standard normal distribution. * */ public class FatigueLifeGen extends RandomVariateGen { protected double mu; protected double beta; protected double gamma; /** * Creates a fatigue life random variate generator with * parameters μ = mu, β = beta and γ = * gamma, using stream s. * */ public FatigueLifeGen (RandomStream s, double mu, double beta, double gamma) { super (s, new FatigueLifeDist(mu, beta, gamma)); setParams (mu, beta, gamma); } /** * Creates a new generator for the distribution dist, * using stream s. * */ public FatigueLifeGen (RandomStream s, FatigueLifeDist dist) { super (s, dist); if (dist != null) setParams (dist.getMu(), dist.getBeta(), dist.getGamma()); } /** * Generates a variate from the fatigue life distribution * with location parameter μ, scale parameter β and shape parameter * γ. * */ public static double nextDouble (RandomStream s, double mu, double beta, double gamma) { return FatigueLifeDist.inverseF (mu, beta, gamma, s.nextDouble()); } /** * Returns the parameter β of this object. * */ public double getBeta() { return beta; } /** * Returns the parameter γ of this object. * */ public double getGamma() { return gamma; } /** * Returns the parameter μ of this object. * * */ public double getMu() { return mu; } /** * Sets the parameters μ, β and γ of this object. * */ protected void setParams (double mu, double beta, double gamma) { if (beta <= 0.0) throw new IllegalArgumentException ("beta <= 0"); if (gamma <= 0.0) throw new IllegalArgumentException ("gamma <= 0"); this.mu = mu; this.beta = beta; this.gamma = gamma; } }

Ads help maintain this website.