# import the library numpy as np
# import the library matplotlib.pyplt as plt
import numpy as np
import matplotlib.pyplot as plt

# set a seed for your calculations so that they are reproducible
rand_seed = np.random.seed(123456)

# generate 50 random integers from 1 to 50 using random.randint() and make a
# frequency histogram
rand_seed = np.random.randint (low = 1, high = 50, size = 50)
print(rand_seed)

plt.hist(rand_seed, bins = 10)
plt.show()

# generate 10000 random integers from 1 to 50 using random.randint() and make a
# frequency histogram
# compare with previous histogram
rand_seed_2 = np.random.randint(low = 1, high = 50, size = 10000)

plt.hist(rand_seed_2, bins = 10)
plt.show()

# generate 1000 floating point numbers uniformly distributed from 1 to 100 and make a
# frequency histogram
rand_seed_3 = np.random.uniform(low = 1, high = 50, size = 10000)

plt.hist(rand_seed_2, bins = 10)
plt.show()

# generate 1000 floating point numbers normally distributed about a mean of 50
# with a standard deviation of 5 and make a frequency histogram
y = np.random.normal(50,5, size = 1000)
print (y)
plt.hist(y, bins = 10)
plt.show()

# 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

# import random and set seed
import random
s = np.random.seed(123456)

# Simulate drawing a single ball; each ball has a number from from 1 to 50
b = np.random.randint(low = 1, high = 50)

# Simulate drawing 100 balls and keep track of the number of balls
# that have a number less than 25
b = np.random.randint(low = 1, high = 50, size = 100)
a = 25
k = 0
for i in b:
if i < a:
k = k + 1
print(f"Balls less than 25 are: {k}")

# 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
def Ball():
x = np.random.randint(low = 1, high = 50)
if x < 25:
print('True')
elif x >= 25:
print("False")
print(x)
Ball()