<div dir="ltr">Dirk,<div><br></div><div style> you are right, intuitively I see that the way I'm doing things doesn't</div><div style>seem very save. The motivation behind my experimentation is that </div><div style>
I'm trying to move things from R to C++ in order to avoid that segfault</div><div style>problem that we observed a couple of weeks ago.</div><div style>Probably I'm clinging a bit too much to R RNGs, but maybe I should</div>
<div style>switch to a C++ RNG. The problem is complicated also by the fact</div><div style>that I'm using the parallel package, so I have to careful about what I do!   </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Jun 7, 2013 at 5:12 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Matteo,<br>
<br>
Maybe you may need to figure this out in plain C(++) code based on the<br>
Writing R Extensions manual first.  R makes an assumption about keeping the<br>
RNGs in a good state, I am not entirely sure if you actually can do what you<br>
want to do. Just because you can call an R function from Rcpp does not mean<br>
it will do the right thing.<br>
<br>
Maybe what you want is more easily done with the RNGs from C++ (esp C++11),<br>
Boost, ... or something different from R.   It may work, but we are<br>
(currently) simply not set up for it.<br>
<br>
The model is to call set.seed(somenumber) from R before going to C++, and<br>
being assured that a) you get the same stream in C++ as you would in R as<br>
well as b) that you can continue fine in R once you are back.<br>
<br>
What you want is a little different.  It may well be supported, but maybe<br>
just not (yet ?) by us. Or it may not be supported.  Please keep working at<br>
it, this would be useful to sort this out.<br>
<br>
Just because you can get the integer seed via R from C++ does yet mean that<br>
the generator is a sane state.  Just saying...<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font></span></blockquote></div><br></div>