src/mongo/shell/utils.js
/**
     * Generate a random value from the normal distribution with specified 'mean' and
     * 'standardDeviation'.
     */
Generate a random value from the normal distribution with specified 'mean' and
'standardDeviation'.
Generate a random value from the normal distribution with specified ' mean ' and ' standardDeviation ' .
function genNormal(mean, standardDeviation) {
        if (!initialized) {
            throw new Error(errorMsg);
        }
        while (true) {
            var x = (2 * rand()) - 1;
            var y = (2 * rand()) - 1;
            var s = (x * x) + (y * y);
            if (s > 0 && s < 1) {
                var standardNormal = x * Math.sqrt(-2 * Math.log(s) / s);
                return mean + (standardDeviation * standardNormal);
            }
        }
    }
function genNormal ( mean , standardDeviation ) { if ( ! initialized ) { throw new Error ( errorMsg ) ; } while ( true ) { var x = ( 2 * rand ( ) ) - 1 ; var y = ( 2 * rand ( ) ) - 1 ; var s = ( x * x ) + ( y * y ) ; if ( s > 0 && s < 1 ) { var standardNormal = x * Math . sqrt ( - 2 * Math . log ( s ) / s ) ; return mean + ( standardDeviation * standardNormal ) ; } } }
Generate a random value from the normal distribution with specified 'mean' and
 'standardDeviation'.
Generate a random value from the normal distribution with specified ' mean ' and ' standardDeviation ' .
// See http://en.wikipedia.org/wiki/Marsaglia_polar_method