# import the library numpy as np
# import the library matplotlib.pyplt as plt
import numpy as np
from matplotlib import pyplot as plt
# set a seed for your calculations so that they are reproducible
x = np.random.seed (123456)
# generate 50 random integers from 1 to 50 using random.randint() and make a
# frequency histogram
fifty_random=np.random.randint(0,50)
plt.hist(fifty_random)
# generate 10000 random integers from 1 to 50 using random.randint() and make a
# frequency histogram
# compare with previous histogram
one_thousand_random=np.random.randint(0,1000)
plt.hist(one_thousand_random)
# generate 1000 floating point numbers uniformly distributed from 1 to 100 and make a
# frequency histogram
a=np.random.uniform(1,100)
plt.hist(a)
# generate 1000 floating point numbers normally distributed about a mean of 50
# with a standard deviation of 5 and make a frequency histogram
#
b=np.random.uniform(100,50,5)
plt.hist(b)
# generate 1000 floating point numbers normally distributed about a mean of 50
# with a standard deviation of 5 and make a density histogram; compare with frequency
# histogram
c=np.random.normal(1000,50,5)
plt.hist(c)
# import random and set seed
import random
x = np.random.seed (123456)
# Simulate drawing a single ball; each ball has a number from from 1 to 50
draw=np.random.randint(1,50)
print(draw)
# Simulate drawing 100 balls and keep track of the number of balls
# that have a number less than 25
for i in range (0,100):
draw=np.random.randint(1,100)
# Calculate discrete probability that you will draw a ball with a number <25 using 10,000
# simulations
# Now suppose you are playing a game where you draw a ball. You win if you get a number
# <25 and lose otherwise. Write a function which draws a single ball and returns True
# if the number is <25 and false if it is >= 25
# Test out your function