Skip to content

Instantly share code, notes, and snippets.

@ryanseys
Created March 17, 2015 20:46
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 ryanseys/37d8dc63d72316bfb252 to your computer and use it in GitHub Desktop.
Save ryanseys/37d8dc63d72316bfb252 to your computer and use it in GitHub Desktop.
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