[Rcpp-devel] clarification of interaction between RInside and RcppEigen
Dirk Eddelbuettel
edd at debian.org
Tue Aug 7 23:34:26 CEST 2012
Also note that "just" getting random numbers is taken care of via Rcpp sugar
which wraps rnorm() etc:
R> library(inline)
R>
R> R> f <- cxxfunction(signature(), plugin="Rcpp", body='
+ Rcpp::RNGScope tmp;
+ return rnorm(3);
+ ')
R>
R> set.seed(42)
R> rnorm(3) ## using R
[1] 1.370958 -0.564698 0.363128
R> set.seed(42)
R> f() ## using the Rcpp function just created
[1] 1.370958 -0.564698 0.363128
R>
Same RNG draws, as we deal properly with the RNG state (where RNGScope
helps). Look at the list archives, this has been discussed a few times if
it seems too "magic".
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list