From e707583709b97584927d5e835db1b346908c51e1 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 6 Oct 2016 22:42:41 +0200 Subject: remove Python material from R branch --- Python/SyncRNG.py | 48 ------------------------------------------------ setup.py | 19 ------------------- 2 files changed, 67 deletions(-) delete mode 100644 Python/SyncRNG.py delete mode 100644 setup.py diff --git a/Python/SyncRNG.py b/Python/SyncRNG.py deleted file mode 100644 index 0ab4c06..0000000 --- a/Python/SyncRNG.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Simple interface to SyncRNG. This file defines a SyncRNG object which can be -used to seed and pull numbers from the RNG. - -""" - -from __future__ import division - -from copy import deepcopy -from warnings import warn as _warn - -import syncrng - -class SyncRNG(object): - - def __init__(self, seed=0): - self.BPF = 32 - self.seed = seed - self.state = syncrng.seed(seed) - - def randi(self): - tmp = syncrng.rand(self.state) - self.state = tmp[:-1] - return(tmp[-1]) - - def rand(self): - return self.randi() * 2.3283064365387e-10 - - def randbelow(self, n): - maxsize = 1<= maxsize: - _warn("Underlying random generator does not supply \n" - "enough bits to choose from a population range this " - "large.\n") - return int(self.rand() * n) - rem = maxsize % n - limit = (maxsize - rem) / maxsize - r = self.rand() - while r >= limit: - r = self.rand() - return int(r*maxsize) % n - - def shuffle(self, x): - y = deepcopy(x) - for i in reversed(range(1, len(y))): - j = self.randbelow(i+1) - y[i], y[j] = y[j], y[i] - return y diff --git a/setup.py b/setup.py deleted file mode 100644 index 985c1eb..0000000 --- a/setup.py +++ /dev/null @@ -1,19 +0,0 @@ - -from distutils.core import setup, Extension - -setup( - name='SyncRNG', - author='Gertjan van den Burg', - version='1.0', - description='A synchronized Tausworthe RNG for Python and R', - license='GPL v2', - package_dir={'': 'Python'}, - packages=[''], - ext_modules=[ - Extension( - "syncrng", - define_macros=[('TARGETPYTHON', '1')], - sources=["src/syncrng.c"] - ) - ], - ) -- cgit v1.2.3