示例#1
0
 double sample() {
   try {
     return gd.sample();
   } catch (MathException e) {
     throw new RuntimeException(e);
   }
 }
  /**
   * Generate a random value from this distribution.
   *
   * @param rng random number generator
   * @return random value from this distribution
   */
  public double generate(MersenneTwisterFast rng) {
    try {
      return gammaDist.inverseCumulativeProbability(rng.nextDouble());
    } catch (MathException e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
      System.exit(-1);
    }

    return -1d;
  }