question: public double nextGaussian ( ) { if ( mHaveNextNextGaussian ) { mHaveNextNextGaussian = false ; return mNextNextGaussian ; } else { double v1 , v2 , s ; do { v1 = 2 * nextDouble ( ) - 1 ; v2 = 2 * nextDouble ( ) - 1 ; s = v1 * v1 + v2 * v2 ; } while ( s >= 1 || s == 0 ) ; final double multiplier = StrictMath . sqrt ( - 2 * StrictMath . log ( s ) / s ) ; mNextNextGaussian = v2 * multiplier ; mHaveNextNextGaussian = true ; return v1 * multiplier ; } }
target:  Return the next Gaussian See Knuth, ACP, Section 3.4.1 Algorithm C.