[R] .Random.seed for the Mersenne Twister
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Jan 9 16:40:09 CET 2020
I am no expert on this specific algorithm, but there is no "32-bit unsigned integer" type in R. Presumably the interpretation of those negative numbers in the C code is as if they were unsigned while R presents them as if they were signed because it cannot do otherwise.
AFAIK you need to use set.seed to configure .Random.seed, and you can retrieve and later restore the vectors created this way in the future. As I understand it there exist invalid vectors that cannot arbitrarily be used by this algorithm so generating them yourself is at the very least hard, and possibly could break in future versions of R.
On January 9, 2020 1:18:01 AM PST, Luca Passalacqua via R-help <r-help using r-project.org> wrote:
>Dear R users,
> inspecting .Random.seed for the Mersenne Twister (MT) I find (many)
>negative values for the
>624 values of the initial state of the generator.
>It seems to me that this is a bug (an unsigned integer mapped to a
>since, to my understanding, the R version of MT should be working with
>32-bits unsigned long.
>Moreover, this prevents starting the generator by setting .Random.seed
>Could someone please provide some insight to this issue ?
>> RNGkind('default')> RNGkind() "Mersenne-Twister" "Inversion"
>> set.seed(1)> .Random.seed  403 624 -169270483
>-442010614 -603558397 ...
Sent from my phone. Please excuse my brevity.
More information about the R-help