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.