Skip to content

Instantly share code, notes, and snippets.

@chyld
Created October 29, 2020 14:17
Show Gist options
  • Select an option

  • Save chyld/fb02cf437ac5d4ccf50e9a5105c01213 to your computer and use it in GitHub Desktop.

Select an option

Save chyld/fb02cf437ac5d4ccf50e9a5105c01213 to your computer and use it in GitHub Desktop.
def plot_uniform(start, order_of_magnitude, rows, cols, *colors):
fig = plt.figure(figsize=(12, 7))
for i in range(1, order_of_magnitude + 1):
samples = start ** i
vals, counts = np.unique(randint(low=1, high=7).rvs(samples), return_counts=True)
ax = fig.add_subplot(rows, cols, i)
ax.bar(vals, counts, color=colors[i-1], alpha=0.7)
ax.set_title("{} samples".format(samples))
plt.suptitle('Dice Rolls', fontsize=50)
fig.tight_layout()
@chyld
Copy link
Author

chyld commented Oct 29, 2020

# a golf ball on average weighs 1.62 ounces, with a variance of 0.04.
# what is the probability of a randomly selected golf ball having a weight between 1 oz and 2 oz?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment