def CPT sum for in range sum random random return sum def muller mu si

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def CPT():
sum = 0
for i in range(6):
sum += random.random()
return sum/6.
def muller(mu, sigma):
return mu*abs(1 + (-2*math.log(random.random()))**0.5 * math.cos(2*math.pi*random.random())*sigma)
def neumann(mu, sigma):
x = random.uniform(-10, 10)
y = random.uniform(0, 4)
while True:
if normal(x, mu, sigma) < y:
return normal(x, mu, sigma)
else:
x = random.uniform(-10, 10)
y = random.uniform(0, 4)