[R] How to construct a valid seed for l'Ecuyer's method with given .Random.seed?
marius.hofert at math.ethz.ch
Wed Jan 23 23:24:11 CET 2013
Thanks for helping.
I am still wondering, why m1 (which should be 2^32-209 [see line 34 in
./src/RngStream.c]) is -767742437 in my case and why the minimal example you
gave was working for you but isn't for me.
Apart from that, ?.Random.seed -> "L'Ecuyer-CMRG" says:
| The 6 elements of the seed are internally regarded as 32-bit
| unsigned integers. Neither the first three nor the last
| three should be all zero, and they are limited to less than
| ‘4294967087’ and ‘4294944443’ respectively.
=> .Random.seed provides a *signed* integer. I tried to convert it to an
.Random.seed[-1] # => unsigned
seed <- .Random.seed[-1] + 2^32 # => shifting
... but it fails with
| Error in .lec.SetPackageSeed(seed) : Seed >= 14, Seed is not set.
=> so there seem to be the requirement that the second element of the seed is <
I might have done the conversion to a signed integer incorrectly, though.
It would be great if the seed was checked *precisely* (not just basic length
checks) in R, maybe in .lec.CheckSeed(). That would rule out further problems
and strange error messages from C, which are harder to debug.
What are the precise conditions for the seed in 'rlecuyer'? Judging from the
above error, the second element must be < 14. But, additionally,... ?
I hope there is a solution to the problem of "how to convert .Random.seed to get
a valid seed for 'rlecuyer'"... we need that in a package.
Hana Sevcikova <hanas at uw.edu> writes:
> I looked it up in the original L'Ecuyer's paper: The seed must be larger than
> 0. Thus, the function defines the seed variable as unsigned long integer. You're
> passing a negative number, so I think there is some overflow going on.
> The internal L'Ecuyer RNG is a modification of the original one (and I'm not
> familiar with it), but they seem to relax that restriction.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 835 bytes
Desc: not available
More information about the R-help