## Importing libraries
import numpy as np
import matplotlib.pyplot as plt
## Setting the seed
np.random.seed(151)
## Number of simulations
num_simulations = 2000
# Simulate with sample size one
sample_size = 1
vec_xbar = [None] * num_simulations
for iteration in range(num_simulations):
vec_unif = np.random.uniform(low = -2, high=2, size = sample_size)
vec_xbar[iteration] = vec_unif.mean()
plt.hist(vec_xbar)
plt.title("Distribution of Xbar with size 1")
plt.ylabel("Frequency")
plt.xlabel("Values of Xbar")
plt.show()