Skip to content

Instantly share code, notes, and snippets.

@nicovillanueva
Created July 31, 2014 05:08
Show Gist options
  • Save nicovillanueva/57bde4a56e7d6422d8e4 to your computer and use it in GitHub Desktop.
Save nicovillanueva/57bde4a56e7d6422d8e4 to your computer and use it in GitHub Desktop.
Generates dice throws for D&D (or originally thought for such), and kept me busy for 10 minutes.
#!/usr/bin/python
import random
d = raw_input("Using dice: d")
a = raw_input("How many die?: ")
t = raw_input("How many times?: ")
if a == "": a=1
if t == "": t=1
for times in range(int(t)):
if t > 1: print "--- Throw " + str(times+1)
for amount in range(int(a)):
print str(random.randint(1, int(d)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment