package yi.stat;

/**
 * Utility functions for probabilities
 */

public class ProbUtil {
  /**
   * Generate a double using normal distribution (Gaussian given by mu, sigma)
   * @param mu
   * @param sigma
   * @return
   */
  public static double normal(double mu,double sigma) {
          double x = mu + sigma*Math.cos(2*Math.PI*Math.random())*Math.sqrt(-2*Math.log(Math.random()));
          return x;
  }
}