Skip to content

Instantly share code, notes, and snippets.

@wellcaffeinated
Created November 19, 2013 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wellcaffeinated/7540411 to your computer and use it in GitHub Desktop.
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.
// 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