diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-01-14 17:06:19 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-01-14 17:06:19 +0000 |
| commit | 9187fc1fd45203c2e3501a8b55236e9db71fc2ed (patch) | |
| tree | 572cffe74f5894f9cf1bd5168ee462cfc4afe9a9 /tests/test.R | |
| parent | update python version with R version (diff) | |
| parent | cast to int explicitly (diff) | |
| download | SyncRNG-9187fc1fd45203c2e3501a8b55236e9db71fc2ed.tar.gz SyncRNG-9187fc1fd45203c2e3501a8b55236e9db71fc2ed.zip | |
Merge branch 'bugfix/python_error' into python
Diffstat (limited to 'tests/test.R')
| -rw-r--r-- | tests/test.R | 43 |
1 files changed, 43 insertions, 0 deletions
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() |
