Thanks a lot, Duncan, that solved it! Cheers,
Marius Duncan Murdoch writes: > On 13-01-24 2:09 AM, Marius Hofert wrote: >> Dear Daniel, >> >> That's exactly what I also suspected (last post). The question now seems how >> to >> correctly convert .Random.seed from signed to unsigned so that it is >> accepted by >> the rlecuyer package. > > The rlecuyer package assumes that seed values are positive internally, because > it does this conversion in the C code: > > seed[i]= (unsigned long) REAL(sexp_seed)[i] > > If you send it negative values, the result of this is undefined. > > I'd suggest that the .lec.CheckSeed function should check for this and quit if > it's not true. > > When you tried to convert everything to be positive, you used > > seed <- .Random.seed[-1] + 2^32 > > This will put negative values into the right range, but positive values will > end > up too big, and again the results in the C code will overflow. > > You should be able to get proper behaviour this way: > > seed <- .Random.seed[-1] > seed <- ifelse(seed < 0, seed + 2^32, seed) > > which puts values into the legal range for an unsigned int. When I do this, I > don't get an error running > > .lec.SetPackageSeed(seed) > > You got an error Seed[1] >= 14, which comes from an error in the rlecuyer > package formatting of the error message. It is printing a floating point > value > using a %d format, instead of %f. > > Duncan Murdoch
pgpl9WD8VQqM2.pgp
Description: PGP signature
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.