aboutsummaryrefslogtreecommitdiff
path: root/test/test.py
diff options
context:
space:
mode:
authorGertjan van den Burg <burg@ese.eur.nl>2015-07-31 16:21:25 +0200
committerGertjan van den Burg <burg@ese.eur.nl>2015-07-31 16:21:25 +0200
commit2971238c8957df1bce0629c12d8c209b39328590 (patch)
tree5c84f9bede77ea23d6bc3467cbb82e619feb85ac /test/test.py
parentmore reliable way to import SyncRNG from R (diff)
downloadSyncRNG-2971238c8957df1bce0629c12d8c209b39328590.tar.gz
SyncRNG-2971238c8957df1bce0629c12d8c209b39328590.zip
reformat to proper python and R packages
Diffstat (limited to 'test/test.py')
-rw-r--r--test/test.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test.py b/test/test.py
new file mode 100644
index 0000000..ea0b79f
--- /dev/null
+++ b/test/test.py
@@ -0,0 +1,34 @@
+
+from SyncRNG import SyncRNG
+
+def test_randi():
+ s = SyncRNG(seed=123456)
+ for i in range(5):
+ print(s.randi())
+
+def test_rand():
+ s = SyncRNG(seed=123456)
+ for i in range(5):
+ print(s.rand())
+
+def test_randbelow():
+ s = SyncRNG(seed=123456)
+ for i in range(5):
+ print(s.randbelow(i+1))
+
+def test_shuffle():
+ s = SyncRNG(seed=123456)
+ x = [1, 2, 3, 4, 5]
+ for i in range(5):
+ y = s.shuffle(x)
+ x = y
+ print(y)
+
+def main():
+ test_randi()
+ test_rand()
+ test_randbelow()
+ test_shuffle()
+
+if __name__ == '__main__':
+ main()