Created
April 26, 2018 15:43
-
-
Save supereggbert/fe5fb7b1fc30609e983b0207ae136707 to your computer and use it in GitHub Desktop.
Simple Random Gaussian Function in Javascript
This file contains 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
function gaussianRandom(mean,sigma){ | |
var u = Math.random(); | |
return (u%1e-8>5e-9?1:-1)*Math.sqrt(-Math.log(Math.max(1e-9,u)))*sigma+mean; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment