# 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
seed = np.random.seed(12345)

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

```
[29 36 47 37 16 24 28 17 21 26 1 45 16 45 2 4 18 9 2 8 37 18 39 44
23 36 20 11 17 40 39 13 32 19 10 16 6 24 21 26 49 21 39 1 16 22 8 20
34 7]
```

plt.hist(seed, bins = 5)
plt.show()

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

plt.hist(seed2, bins = 5)
plt.show()

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

plt.hist(seed3, bins = 5)
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
#
i = np.random.normal(50,5, size = 1000)

plt.hist(i, bins = 5)
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
n = np.random.normal(50,5, size = 1000)

plt.hist(n, bins = 5, density=True)
plt.show()

# import random and set seed
import random
i = np.random.seed(12345)

# Simulate drawing a single ball; each ball has a number from from 1 to 50
ballsim = 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
ballsim = np.random.randint(low = 1, high = 50, size = 50)
max = 25
min = 0
for i in ballsim:
if i < max:
min = min + 1
print(f"There are {min} balls under 25")

```
There are 28 balls under 25
```

# Calculate discrete probability that you will draw a ball with a number <25 using 10,000
# simulations
ballsim = np.random.randint(low = 1, high = 50, size = 10000)
max=25
min=0
for i in ballsim:

Execution error

SyntaxError: unexpected EOF while parsing (<ipython-input-22-a7fbf5b8a50a>, line 7)

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

```
17
True
```