Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Tommy Jones
Abby, that is a fantastic suggestion! It seems obvious now that you've said it. Why didn't I think of that? Thank you, Tommy On Fri, Jul 31, 2020 at 12:01 AM Abby Spurdle wrote: > > 3. In C++: Draw millions of times from a Categorical(p) distribution, > where > > "p" is recalculated after each

Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Abby Spurdle
> 3. In C++: Draw millions of times from a Categorical(p) distribution, where > "p" is recalculated after each draw I don't see the need here. It should be possible to generate all the random numbers , *in R*, and in *one line* of R code. Easy... Then standard inversion sampling, can be used to t

Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Tommy Jones
Thank you Duncan and Gabriel. I think that my trivial example was a little too trivial and is causing some confusion. What's happening in the real function I'm writing is... 1. In R: Draw tens-of-thousands of times from a handful to Gamma RVs with different parameters to initialize some variables

Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Duncan Murdoch
On 30/07/2020 4:30 p.m., Tommy Jones wrote: Thank you for this. I'd like to be sure I understand the intuition correctly. Is the following true from what you said? I can just fix the seed at the C++ level and the results will still be (pseudo) random because the initialization at the R level i

Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Gabriel Becker
Tommy, I'm not Duncan (and am not nor claim to be an RNG expert) but I believe RNG streams are designed and thus tested, to be used as streams. Repeatedly setting the seed after small numbers of samples from them does not fit the designed usecase (And also doesn't match the test criteria by which

Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Tommy Jones
Thank you for this. I'd like to be sure I understand the intuition correctly. Is the following true from what you said? I can just fix the seed at the C++ level and the results will still be (pseudo) random because the initialization at the R level is (pseudo) random. On Thu, Jul 30, 2020 at 3:36

Re: [Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Duncan Murdoch
I wouldn't trust the C++ generator to be as good if you seed it this way as if you just seeded it once with your phone number (or any other fixed value) and let it run, because it's probably never been tested to be good when run this way. Is it good enough for the way you plan to use it? Mayb

[Rd] Seeding non-R RNG with numbers from R's RNG stream

2020-07-30 Thread Tommy Jones
Hi, I am constructing a function that does sampling in C++ using a non-R RNG stream for thread safety reasons. This C++ function is wrapped by an R function, which is user facing. The R wrapper does some sampling itself to initialize some variables before passing them off to C++. So that my users