示例#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()