public static double nextInverseGaussian(double mu,double lambda){
synchronized (random) {
    double v=random.nextGaussian();
    double y=v * v;
    double x=mu + (mu * mu * y) / (2 * lambda) - (mu / (2 * lambda)) * Math.sqrt(4 * mu * lambda* y + mu * mu * y* y);
    double test=MathUtils.nextDouble();
    if (test <= (mu) / (mu + x)) {
      return x;
    }
 else {
      return (mu * mu) / x;
    }
  }
}

public static double nextInverseGaussian ( double mu , double lambda ) { synchronized ( random ) { double v = random . nextGaussian ( ) ; double y = v * v ; double x = mu + ( mu * mu * y ) / ( 2 * lambda ) - ( mu / ( 2 * lambda ) ) * Math . sqrt ( 4 * mu * lambda * y + mu * mu * y * y ) ; double test = MathUtils . nextDouble ( ) ; if ( test <= ( mu ) / ( mu + x ) ) { return x ; } else { return ( mu * mu ) / x ; } } }
access a default instance of this class , access is synchronized
