aboutsummaryrefslogtreecommitdiff
path: root/test.R
diff options
context:
space:
mode:
Diffstat (limited to 'test.R')
-rw-r--r--test.R44
1 files changed, 44 insertions, 0 deletions
diff --git a/test.R b/test.R
new file mode 100644
index 0000000..a94d47b
--- /dev/null
+++ b/test.R
@@ -0,0 +1,44 @@
+
+source('./SyncRNG.R')
+
+test.randi <- function()
+{
+ s <- SyncRNG(seed=123456)
+ for (i in 1:5)
+ cat(s$randi(), '\n')
+}
+
+test.rand <- function()
+{
+ s <- SyncRNG(seed=123456)
+ for (i in 1:5)
+ cat(s$rand(), '\n')
+}
+
+test.randbelow <- function()
+{
+ s <- SyncRNG(seed=123456)
+ for (i in 1:5)
+ cat(s$randbelow(i), '\n')
+}
+
+test.shuffle <- function()
+{
+ s <- SyncRNG(seed=123456)
+ x <- c(1:5)
+ for (i in 1:5) {
+ y <- s$shuffle(x)
+ x <- y
+ cat(y, '\n')
+ }
+}
+
+main <- function()
+{
+ test.randi()
+ test.rand()
+ test.randbelow()
+ test.shuffle()
+}
+
+main()