Created
May 10, 2011 18:22
-
-
Save stober/965049 to your computer and use it in GitHub Desktop.
Flip a Coin
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
import random as pr | |
def flip(p): | |
""" Flip a biased coin. """ | |
if pr.random() < p: | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment