[Rcpp-devel] for loop and random draws

Dirk Eddelbuettel edd at debian.org
Fri Oct 25 22:27:09 CEST 2024


On 25 October 2024 at 15:42, Denis Haine wrote:
| I'm totally puzzled on why I've got these results. How can I get the same
| output with Rcpp + regression as with the R loop +/- regression?

I think you continue to gloss over the fact there "is a contract": we call
C++ code from R, Rcpp helps, Rcpp aligns the RNG state and restores it, this
all works well.

You violate (somehow, not entirely sure how/why) this contract via your
pattern of calling _back into R_ from your C++ code. And I think that part is
the source of your problem.

I think I suggested last time that you work it out with smaller and smaller
test cases. That still seems like a good idea to me.

Good luck,  Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list