Skip to content
Prev 5279 / 10988 Next

[Rcpp-devel] Mersenne Twister in RcppArmadillo?

I made all my simple tests now by using Rcpp::Environment and then Rcpp::Function for "set.seed" when calling R::rnorm. The next step would be to parallelize the iterations via OpenMP. The suggestion of Yan makes quite sense to produce a RNG via std::mt19937. This is also the way I did it when I used Scythe Statistical Library. 
As I use now the R RNG it should be able to use it in parallel, if Rcpp::Function is a kind of wrapper which contains the code of "set.seed". But I would rather guess, that it is a call object, that just calls the R function "set.seed" in R, which then would not be threadsafe (as also the RNG would then just be called when using R::rnorm).....

So I guess falling back to std::mt19937 is not a bad idea. For no overlapping I just increase the seed in every iteration dependent on the iteration and the number of random numbers to generate. 

Best Simon
On Feb 11, 2013, at 2:16 PM, Chris Jefferson <chris at bubblescope.net> wrote: