Re: [Rcpp-devel] Setting R seed from Cpp (continued)

2013-06-10 Thread Simon Zehnder
Hi Dirk, sorry for reposting. I thought this was specifically about getting the second approach of Matteo run in the same way as the first one. Yeah, the RNG thing is something I myself haven't yet figured totally out. Especially in regard to Matteo's note, that the final task should run in pa

Re: [Rcpp-devel] Setting R seed from Cpp (continued)

2013-06-10 Thread Dirk Eddelbuettel
Simon, On 10 June 2013 at 20:22, Simon Zehnder wrote: | this is an interesting post. My assumption is, that as in the first approach I fear tou may be a couple of posts late. Please see http://thread.gmane.org/gmane.comp.lang.r.rcpp/5651 Thanks, Dirk -- Dirk Eddelbuettel | e...@debian.or

Re: [Rcpp-devel] Setting R seed from Cpp (continued)

2013-06-10 Thread Simon Zehnder
Hi Matteo, this is an interesting post. My assumption is, that as in the first approach you call an R function which is implemented as a pointer (or reference to an R function) this function always has access to the RNG scope. Whereas in the second approach you call nested, which is a CPP-funct

[Rcpp-devel] Setting R seed from Cpp (continued)

2013-06-10 Thread Matteo Fasiolo
Hi all, I continued experimenting with setting the R seed from an Rcpp function. While this code works: cppFunction(' List myFun(int n, Function foo) { RNGScope scope; Environment g = Environment::global_env(); Environment::Binding RandomSeed = g[".Random.seed"]; IntegerVector