On 12 July 2013 at 21:04, Neal Fultz wrote: | I use the debian packages. Upgrading r-cran-rcpp from testing to unstable | seems to have fixed this for me, so good call.
It is so easy to install from source so that I usually recommend that. And yes, I am the maintainer of r-cran-rcpp :) I played with this a little on the flight, and as Krzysztof noted, this was unreproducible: ## Works here: R> set.seed(42); table(replicate(10000, f_broke(p))) 1 2 3 4 1029 2011 2937 4023 R> set.seed(42); table(replicate(10000, f_works(p))) 1 2 3 4 1029 2011 2937 4023 R> ## Also: cppFunction(' Rcpp::NumericVector unifRandTest(int n) { Rcpp::NumericVector x(n); for (int i=0; i<n; i++) { x[i] = unif_rand(); } return x; } ') R> set.seed(42); a <- runif(1e5) R> set.seed(42); b <- unifRandTest(1e 5) R> identical(a, b) [1] TRUE R> So unif_rand could be used, but I find runif (either vectorised from Rcpp sugar or 'scalar' from the R namespace) easier as it mimicks the R use. 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