generateSeedVectors {dqrng} | R Documentation |
Generate seed as a integer vector
Description
Generate seed as a integer vector
Usage
generateSeedVectors(nseeds, nwords = 2L)
Arguments
nseeds |
Integer scalar, number of seeds to generate. |
nwords |
Integer scalar, number of words to generate per seed. |
Details
Each seed is encoded as an integer vector with the most significant bits at the start of the vector. Each integer vector is converted into an unsigned integer (in C++ or otherwise) by the following procedure:
Start with a sum of zero.
Add the first value of the vector.
Left-shift the sum by 32.
Add the next value of the vector, and repeat.
The aim is to facilitate R-level generation of seeds with sufficient
randomness to cover the entire state space of pseudo-random number
generators that require more than the ~32 bits available in an
int
. It also preserves the integer nature of the seed, thus
avoiding problems with casting double-precision numbers to integers.
It is possible for the seed vector to contain NA_integer_
values. This should not be cause for alarm, as R uses -INT_MAX
to encode missing values in integer vectors.
Value
A list of length n
, where each element is an integer vector that
contains nwords
words (i.e., 32*nwords
bits) of randomness.
Author(s)
Aaron Lun
Examples
generateSeedVectors(10, 2)
generateSeedVectors(5, 4)