[Rcpp-devel] Rcpp bug with rgamma
edd at debian.org
Sun Oct 3 18:11:44 CEST 2010
The problem goes away as soon as you set the seeds to the RNGs:
edd at max:/tmp$ cat colin.r
set.seed(42) # this makes all the difference
foo <- "return(Rcpp::wrap(rgamma(3,1,1)));"
fun <- cxxfunction(signature(), foo, plugin = "Rcpp")
edd at max:/tmp$ r colin.r
Loading required package: methods
 1.93930 0.18042 0.53443
edd at max:/tmp$
I am not quite sure why that is needed for rgamma() when it isn't for all the
other distributions. We'll take a look -- but your code should now be fine.
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel