package umontreal.iro.lecuyer.randvar;
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
/**
* This class implements random variate generators for the
* Johnson SU distribution.
*
*/
public class JohnsonSUGen extends RandomVariateGen {
private double gamma;
private double delta;
private double xi;
private double lambda;
/**
* Creates a JohnsonSU random variate generator.
*
*/
public JohnsonSUGen (RandomStream s, double gamma, double delta,
double xi, double lambda) {
super (s, new JohnsonSUDist(gamma, delta, xi, lambda));
setParams (gamma, delta, xi, lambda);
}
/**
* Creates a new generator for the JohnsonSU
* distribution dist, using stream s.
*
*/
public JohnsonSUGen (RandomStream s, JohnsonSUDist dist) {
super (s, dist);
if (dist != null)
setParams (dist.getGamma(), dist.getDelta(), dist.getXi(),
dist.getLambda());
}
/**
* Uses inversion to generate a new JohnsonSU variate,
* using stream s.
*
*/
public static double nextDouble (RandomStream s, double gamma,
double delta, double xi, double lambda) {
return JohnsonSUDist.inverseF (gamma, delta, xi, lambda,
s.nextDouble());
}
/**
* Returns the γ associated with this object.
*
*/
public double getGamma() {
return gamma;
}
/**
* Returns the δ associated with this object.
*
*/
public double getDelta() {
return delta;
}
/**
* Returns the ξ associated with this object.
*
*/
public double getXi() {
return xi;
}
/**
* Returns the λ associated with this object.
*
*
*/
public double getLambda() {
return lambda;
}
/**
* Sets the parameter of this object.
*
*/
protected void setParams (double gamma, double delta,
double xi, double lambda) {
if (lambda <= 0.0)
throw new IllegalArgumentException ("lambda <= 0");
if (delta <= 0.0)
throw new IllegalArgumentException ("delta <= 0");
this.gamma = gamma;
this.delta = delta;
this.xi = xi;
this.lambda = lambda;
}
}
Ads help maintain this website.