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
def exp(p): u = 1.0 - mtpy.mt_drand() return -log(u) / p
def uniform(): #return random.random() return mtpy.mt_drand()
def drand(s): mtpy.mt_seed32new(s) return mtpy.mt_drand() + mtpy.mt_drand()
def drand_const(): mtpy.mt_seed32new(42) return mtpy.mt_drand()
def uniform(): return mtpy.mt_drand()
def exp(p): u = 1.0 - mtpy.mt_drand() return -log(u)/p