Created
March 17, 2015 20:46
-
-
Save ryanseys/37d8dc63d72316bfb252 to your computer and use it in GitHub Desktop.
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
function getUniformRandomNumber() { | |
return Math.random(); | |
} | |
// Rate is the rate parameter of the exponential | |
// distribution. Typically denoted by lambda. | |
function getExponentialRandomNumber(rate) { | |
return Math.log(1 - Math.random()) / (−rate); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment