-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use R_unif_index() instead of unif_rand() and move RNGScope #24
Conversation
That's fine; neither the speed or the difference in the results are a concern. Is it costly to have the |
Construction of a GetRNGState(); // via Rcpp::export attribute
double x = R:runif(0.0, 1.0);
GetRNGState(); // from RNGScope in R_random_u32
double val = R_unif_index(4294967296);
PutRNGState(); // from RNGScope in R_random_u32
PutRNGState(); // via Rcpp::export attribute Now |
Your reasoning sounds sensible. On a more general note, though, the lack of protection from nested |
I think they are aware that it can be really tricky to get the |
Do you have a timeframe for pushing this to CRAN? I don't mean to be pushy, but the next Bioconductor release is coming up soon, and I'd like an opportunity to build all my dqrng-dependent packages with this new generator on the Bioconductor build system. (Especially on Windows, the gift that keeps on giving.) |
The BioC release is sync'd to the CRAN release, so it should occur just after R 3.6.0 comes out (schedule here). So, if we could get the next version of dqrng onto CRAN sometime early next week, I should be able to run it through the BioC build system at least once before they do a commit freeze. |
Version 0.2.0 is on its way to CRAN. |
Works like a charm on my local machine - fingers crossed for the Bioc build system. |
The change from
unif_rand()
toR_unif_index()
changes the amount of RNG draws even before R version 3.6. Loading dqrng, which needs 64 bits for seeding, used to advance R's RNG by two steps:With this change it advances R's RNG by four steps:
Overall this will decrease the speed of
generateseedVectors
and produce different results.@LTLA Would this be a problem for you?