Dirk, you are right, intuitively I see that the way I'm doing things doesn't seem very save. The motivation behind my experimentation is that I'm trying to move things from R to C++ in order to avoid that segfault problem that we observed a couple of weeks ago. Probably I'm clinging a bit too much to R RNGs, but maybe I should switch to a C++ RNG. The problem is complicated also by the fact that I'm using the parallel package, so I have to careful about what I do!
On Fri, Jun 7, 2013 at 5:12 PM, Dirk Eddelbuettel <[email protected]> wrote: > > Matteo, > > Maybe you may need to figure this out in plain C(++) code based on the > Writing R Extensions manual first. R makes an assumption about keeping the > RNGs in a good state, I am not entirely sure if you actually can do what > you > want to do. Just because you can call an R function from Rcpp does not mean > it will do the right thing. > > Maybe what you want is more easily done with the RNGs from C++ (esp C++11), > Boost, ... or something different from R. It may work, but we are > (currently) simply not set up for it. > > The model is to call set.seed(somenumber) from R before going to C++, and > being assured that a) you get the same stream in C++ as you would in R as > well as b) that you can continue fine in R once you are back. > > What you want is a little different. It may well be supported, but maybe > just not (yet ?) by us. Or it may not be supported. Please keep working at > it, this would be useful to sort this out. > > Just because you can get the integer seed via R from C++ does yet mean that > the generator is a sane state. Just saying... > > Dirk > > -- > Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com >
_______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
