Skip to content

Instantly share code, notes, and snippets.

@jenncross
Created March 12, 2019 15:42
Show Gist options
  • Save jenncross/2049052594f811480f9c42b387190175 to your computer and use it in GitHub Desktop.
Save jenncross/2049052594f811480f9c42b387190175 to your computer and use it in GitHub Desktop.
Dice Functions
import random
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def rolldice(number):
rolls = np.zeros((number,), int)
for i in range(number):
die = random.randint(1,6)
rolls[i] = die
return rolls
def testSums(dice_count, roll_count):
sums = np.zeros((roll_count,), dtype=int)
for i in range(roll_count):
sums[i] = rolldice(dice_count).sum()
return sums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment