Jump to content

Linear congruential generator: Difference between revisions

Line 2,706:
i <- i + 1
}
as.integer(x)
x
}
 
seed <- 0
rand_BSD(10)
## [1] 12345 12345 1406932606 654583775 1449466924 229283573 229283573 1109335178
## Big Integer ('bigz') object of length 10:
## [7] 1051550459 1293799192 794471793 551188310
## [1] 12345 1406932606 654583775 1449466924 229283573 1109335178
## [7] 1051550459 1293799192 794471793 551188310
 
rand_MS <- function(n = 1) {
a <- as.bigz(214013)
Line 2,726 ⟶ 2,724:
i <- i + 1
}
as.bigzinteger(x / 2^16)
}
 
seed <- 0
rand_MS(10)
## [1] 38 38 7719 7719 21238 2437 8855 11797 8365 8365 32285 10450 30612</lang>
## Big Integer ('bigz') object of length 10:
## [1] 38 7719 21238 2437 8855 11797 8365 32285 10450 30612</lang>
 
=={{header|Racket}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.