Skip to content

Instantly share code, notes, and snippets.

@jenncross
Last active March 12, 2019 15:50
Show Gist options
  • Save jenncross/4a07f17efc5db8c0be87cdbd583812cb to your computer and use it in GitHub Desktop.
Save jenncross/4a07f17efc5db8c0be87cdbd583812cb to your computer and use it in GitHub Desktop.
Dice Roll Data
import random
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import dice # My custom module
rollsums = testSums(1, 100)
plt.figure()
plt.hist(rollsums,
bins = np.arange(rollsums.min(),rollsums.max()+1)+.5,
rwidth = .75)
plt.xlabel("Sample")
plt.ylabel("Roll Total")
plt.show()
plt.figure()
plt.hist(rollsums,
bins = np.arange(rollsums.min(),rollsums.max()+1)+.5,
rwidth = .75)
plt.xlabel("Roll Total")
plt.ylabel("Count")
plt.show()
myTable = pd.crosstab(index=rollsums, columns="count")
print(myTable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment