Skip to content

Instantly share code, notes, and snippets.

@dilanshah
Last active March 2, 2018 19:31
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 dilanshah/ffa2ccf033081bf0a71f960eca8a21c3 to your computer and use it in GitHub Desktop.
Save dilanshah/ffa2ccf033081bf0a71f960eca8a21c3 to your computer and use it in GitHub Desktop.
Exactly what the title of the script says
# Simulate a five sided die using a seven sided die
import random
def rand7():
return random.randrange(1,8)
def rand5():
roll = rand7()
return roll if roll <= 5 else rand5()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment