import numpy as np
import matplotlib.pyplot as plt
X = np.array([1, 1, 1, 1, 1, 0, 0, 1, 1, 0])
#q = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
print(np.random.normal(loc=0.001, scale=0.0, size=None))
p = []
sum = 1
for j in range(100):
q = np.random.random_sample()
for i in range(100):
index = np.random.choice(a=X, size=1, replace=False, p=None)
if index == 0:
sum *= q
if index == 1:
sum *= 1 - q
p.append([q, sum])
sum = 1
p = np.array(p)
print(p)
p = p[np.argsort(p[:, 0])]
plt.plot(p[:,0], p[:, 1])
plt.show()
# x_max = np.max(p)
# x_min = np.min(p)
# result = []
# for i in p:
# result.append((float(i) - x_min)/(x_max - x_min))
# print(result)