24. Random generators {VeryLargeIntegers} | R Documentation |
Random Generators of vli Objects
Description
Random generators of vli (Very Large Integer) objects following different probability distributions.
Usage
rvlidigits(d)
rvliunif(x, y)
## Default S3 method:
rvliunif(x, y)
## S3 method for class 'numeric'
rvliunif(x, y)
## S3 method for class 'vli'
rvliunif(x, y)
rvlibin(n, p)
## Default S3 method:
rvlibin(n, p)
## S3 method for class 'numeric'
rvlibin(n, p)
## S3 method for class 'vli'
rvlibin(n, p)
rvlinegbin(s, p)
## Default S3 method:
rvlinegbin(s, p)
## S3 method for class 'numeric'
rvlinegbin(s, p)
## S3 method for class 'vli'
rvlinegbin(s, p)
rvliprime(y, iter = 10, test = "MR")
## Default S3 method:
rvliprime(y, iter = 10, test = "MR")
## S3 method for class 'numeric'
rvliprime(y, iter = 10, test = "MR")
## S3 method for class 'vli'
rvliprime(y, iter = 10, test = "MR")
Arguments
d |
number of digits of the vli class object being generated; numeric |
x |
lower bound for the object of class vli being generated; object of class vli or 32 bits integer |
y |
upper bound for the object of class vli being generated; object of class vli or 32 bits integer |
n |
number of independent Bernoulli trials; object of class vli 32 bits integer |
p |
probability of success; numeric |
s |
number of successes; vli class object or 32 bits integer |
iter |
number of iterations for each number to be tested; numeric |
test |
chosen primality test: "F" for the Fermat Test, "SS" for the Solovay-Strassen Test or "MR" (by default) for the Miller-Rabin Test; character |
Details
The function rvlidigits(d)
returns a vli object of d
digits randomly generated following the uniform distribution. It is the most efficient way of generating random vli objects.
The function rvliunif(x, y)
returns a vli object randomly generated following the Uniform distribution with parameters x
and y
.
The function rvlibin(n, p)
returns a vli object randomly generated following the Binomial distribution with parameters n
and p
, where n
is the number of Bernoulli trials and p
the probability of success.
The function rvlinegbin(x, y)
returns a vli object randomly generated following the Negative Binomial distribution with parameters s
and p
, where s
is the number of successes and p
the probability of success.
The function rvliprime(y, iter, test)
returns a vli object randomly chosen from the set of primes up to y
.
Value
objects of class vli in all cases:
rvlidigits(d)
returns a object of class vli belonging to the interval [0, 10^d)
rvliunif(x, y)
returns a object of class vli belonging to the interval [x, y)
rvlibin(n, p)
returns a object of class vli belonging to the interval [0, n]
rvlinegbin(x, y)
returns a object of class vli belonging to the interval [n, Inf)
rvliprime(y, iter, test)
returns a object of class vli with the value of a prime number belonging to the interval [2, y)
Author(s)
Javier Leiva Cuadrado
Examples
rvlidigits(2000)
rvliunif(3425, as.vli("2061341345304562604342"))
rvlibin(100, 0.6)
rvlinegbin(as.vli("1000000"), 0.5)
rvliprime(as.vli("100000"), iter = 10, test = "MR")