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 | e...@debian.org | http://dirk.eddelbuettel.com _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel