My approach
N=20
X1 = np.zeros((N,))
X2 = np.zeros((N,))
X3 = np.zeros((N,))
for i in range(N):
while (X1[i]+X2[i]+X3[i]>1+sys.float_info.epsilon) or (X1[i]+X2[i]+X3[i]<1-sys.float_info.epsilon):
X1[i]= np.random.random()
X2[i]= np.random.random()
X3[i]= np.random.random()
This is not going to work because the computer program will run for a long time. Will there any smart approach?