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



/**
 * This class implements random variate generators for the 
 * Johnson SB distribution. 
 * 
 */
public class JohnsonSBGen extends RandomVariateGen  {
   private double gamma;
   private double delta;
   private double xi;
   private double lambda;



   /**
    * Creates a JohnsonSB random variate generator.
    * 
    */
   public JohnsonSBGen (RandomStream s, double gamma, double delta,
                        double xi, double lambda)  {
      super (s, new JohnsonSBDist(gamma, delta, xi, lambda));
      setParams (gamma, delta, xi, lambda);
   }


   /**
    * Creates a new generator for the JohnsonSB
    *    distribution dist, using stream s.
    * 
    */
   public JohnsonSBGen (RandomStream s, JohnsonSBDist dist)  {
      super (s, dist);
      if (dist != null)
         setParams (dist.getGamma(), dist.getDelta(), dist.getXi(),
                     dist.getLambda());
   } 


   /**
    * Uses inversion to generate a new JohnsonSB variate,
    *    using stream s.
    * 
    */
   public static double nextDouble (RandomStream s, double gamma,
                                    double delta, double xi, double lambda)  {
      return JohnsonSBDist.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 parameters 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.