public double nextDouble(double mean,double standardDeviation){
  if (cacheFilled && this.mean == mean && this.standardDeviation == standardDeviation) {
    cacheFilled=false;
    return cache;
  }
  ;
  double x, y, r, z;
  do {
    x=2.0 * randomGenerator.raw() - 1.0;
    y=2.0 * randomGenerator.raw() - 1.0;
    r=x * x + y * y;
  }
 while (r >= 1.0);
  z=Math.sqrt(-2.0 * Math.log(r) / r);
  cache=mean + standardDeviation * x * z;
  cacheFilled=true;
  return mean + standardDeviation * y * z;
}

public double nextDouble ( double mean , double standardDeviation ) { if ( cacheFilled && this . mean == mean && this . standardDeviation == standardDeviation ) { cacheFilled = false ; return cache ; } ; double x , y , r , z ; do { x = 2.0 * randomGenerator . raw ( ) - 1.0 ; y = 2.0 * randomGenerator . raw ( ) - 1.0 ; r = x * x + y * y ; } while ( r >= 1.0 ) ; z = Math . sqrt ( - 2.0 * Math . log ( r ) / r ) ; cache = mean + standardDeviation * x * z ; cacheFilled = true ; return mean + standardDeviation * y * z ; }
returns a random number from the distribution ; bypasses the internal state .
