Created
January 14, 2010 18:33
-
-
Save vaskoz/277376 to your computer and use it in GitHub Desktop.
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
# Given 50/50 chance of true. | |
def equal_prob | |
return (rand < 0.5) | |
end | |
# 0.314159.. chance of true | |
def biased_prob | |
if equal_prob | |
pivot = 2 * Math::PI / 10 | |
return (rand < pivot) | |
else | |
return false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment