예제 #1
0
 def step(self):
     """Called from run()"""
     if self.leg == 0:
         self.leg += 1
     else:
         u1 = mtpy.mt_drand()
         if u1 < 0.5:
             self.leg -= 1
         else:
             self.leg += 1
     if self.leg == self.substrate:
         self.substrate += 1
예제 #2
0
 def step(self):
     """Called from run()"""
     if self.leg == 0:
         self.leg += 1
     else:
         u1 = mtpy.mt_drand()
         if u1 < 0.5:
             self.leg -= 1
         else:
             self.leg += 1
     if self.leg == self.substrate:
         self.substrate += 1
예제 #3
0
 def exp(p):
     u = 1.0 - mtpy.mt_drand()
     return -log(u) / p
예제 #4
0
 def uniform():
     #return random.random()
     return mtpy.mt_drand()
예제 #5
0
def drand(s):
    mtpy.mt_seed32new(s)
    return mtpy.mt_drand() + mtpy.mt_drand()
예제 #6
0
def drand_const():
    mtpy.mt_seed32new(42)
    return mtpy.mt_drand()
예제 #7
0
def uniform():
    return mtpy.mt_drand()
예제 #8
0
 def exp(p):
     u = 1.0 - mtpy.mt_drand()
     return -log(u)/p
예제 #9
0
 def uniform():
     #return random.random()
     return mtpy.mt_drand()
예제 #10
0
def drand(s):
    mtpy.mt_seed32new(s)
    return mtpy.mt_drand() + mtpy.mt_drand()
예제 #11
0
def drand_const():
    mtpy.mt_seed32new(42)
    return mtpy.mt_drand()