aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2016-10-06 22:42:41 +0200
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2016-10-16 13:00:02 +0200
commite707583709b97584927d5e835db1b346908c51e1 (patch)
tree18229824ca00f32edd8514b3664ad1b2a64acece
parentavoid compile warning for python 2 (diff)
downloadSyncRNG-e707583709b97584927d5e835db1b346908c51e1.tar.gz
SyncRNG-e707583709b97584927d5e835db1b346908c51e1.zip
remove Python material from R branch
-rw-r--r--Python/SyncRNG.py48
-rw-r--r--setup.py19
2 files changed, 0 insertions, 67 deletions
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<<self.BPF
- if n >= 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"]
- )
- ],
- )