Created
March 11, 2019 19:44
-
-
Save sgodfrey66/b854bfeacb154024bba63d4456578028 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import libraries | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
%matplotlib inline | |
# Pick a seed for the random number generator | |
np.random.seed(101) | |
# Generate random integers between 1 and 6 for a sample size of 10 | |
n_sims = 10 | |
print(np.random.randint(1, 7, n_sims)) | |
# Generate random integers between 1 and 6 for a sample size of 10000 | |
n_sims = 10_000 | |
x = np.random.randint(1, 7, n_sims) | |
# Plot the histogram | |
sns.distplot(x, kde = False) | |
plt.title("Histogram of simulated dice rolls") | |
plt.xlim([0,7]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment