Created
November 19, 2013 04:40
-
-
Save wellcaffeinated/7540411 to your computer and use it in GitHub Desktop.
Very crude approximation to gaussian random number. It's fast, but it's NOT accurate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VERY crude approximation to a gaussian random number.. but fast | |
var gauss = function gauss( mean, stddev ){ | |
var r = 2 * (Math.random() + Math.random() + Math.random()) - 3; | |
return r * stddev + mean; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment