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

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

```
[29 21 15 13 37 22 47 40 8 32 32 5 2 43 5 18 19 38 20 13 31 29 43 26
3 36 10 29 49 4 33 38 5 29 19 43 8 46 30 18 33 4 25 40 5 45 1 13
37 49]
```

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

```
[ 6 32 7 ... 46 42 1]
```

# generate 1000 floating point numbers uniformly distributed from 1 to 100 and make a
# frequency histogram
x = np.random.uniform (size = 1000)
x = 1 + (100-1)*x
plt.hist (x, 5)

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

# 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
x = np.random.normal (size = 1000)
x = 50 + (5)*x
y = (x/10000)/5
plt.hist (y, 5)

# import random and set seed
import numpy as np
import matplotlib.pyplot as plt
x = np.random.seed (123456)

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

```
[33]
```

# Simulate drawing 100 balls and keep track of the number of balls
# that have a number less than 25
x = np.random.randint (low = 1, high = 50, size = 100)
print (x)

```
[32 21 5 35 46 31 40 41 11 16 31 43 31 33 39 7 13 49 4 23 5 46 5 1
45 25 18 36 9 39 13 19 45 3 41 27 15 4 33 45 21 37 49 11 42 30 36 30
8 49 47 8 35 47 12 24 4 41 16 35 25 39 39 46 28 11 44 33 8 24 8 6
45 10 49 21 8 2 16 43 6 39 21 46 36 19 34 28 11 11 36 29 20 18 38 15
27 28 27 10]
```

# 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