def gsl_uniform_sequence(n, seed=None): """ Return sample sequence of length n from a uniform distribution. """ try: import pygsl.rng except ImportError: print "Import error: not able to import pygsl" return rng = pygsl.rng.rng() random._inst = random.Random() if seed is None: seed = random.randint(1, 2**32 - 1) rng.set(seed) return rng.uniform(n)
def gsl_uniform_sequence(n,seed=None): """ Return sample sequence of length n from a uniform distribution. """ try: import pygsl.rng except ImportError: print "Import error: not able to import pygsl" return rng=pygsl.rng.rng() random._inst = random.Random() if seed is None: seed=random.randint(1,2**32-1) rng.set(seed) return rng.uniform(n)
def Step(self, rng, step_size): old_x = self._data u = rng.uniform(); new_x = u * 2 * step_size - step_size + old_x; self._data = new_x