blob: a94d47b4fb25d989ae4ca48d95958f9825e4f809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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()
|