mCracker | R Documentation |
Infers the modulus m for a congruential random number generator.
mCracker(U, par = 1e6, maxit = 100)
U |
a numeric vector consisting of n (say 10000) uniform(0,1) pseudorandom numbers of the form x1/m, x2/m, ..., xn/m. |
par |
an integer guess as to an upper bound on the smallest integer in the sequence x1, x2, ..., xn. |
maxit |
maximum number of iterations allowed. |
Basic idea: Let x(1) denote the minimum order statistic in x1, x2, ..., xn. Then the set (x1/m)/(x(1)/m)*(1:par) must contain at least one integer, and m is in that set, if par has been set correctly.
a list consisting of
m |
the integer value of m |
firstInteger |
the minimum order statistic of the set x1, x2, ..., xm |
# set.seed(33663)
x <- runif(1000000)
Y <- mCracker(x)$m
log(Y, 2) # should be 32
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.