From cc61ab3c56c9a2363ea9cfb09c43ed959f1bf596 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 14 Jan 2021 16:52:03 +0000 Subject: Various renames --- tests/test.R | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test.R (limited to 'tests/test.R') diff --git a/tests/test.R b/tests/test.R new file mode 100644 index 0000000..0937f52 --- /dev/null +++ b/tests/test.R @@ -0,0 +1,43 @@ +library(SyncRNG) + +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(sprintf('%.16f\n', s$rand())) +} + +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('[', paste(y, collapse=', '), ']\n', sep='') + } +} + +main <- function() +{ + test.randi() + test.rand() + test.randbelow() + test.shuffle() +} + +main() -- cgit v1.2.3