Seeding non-R RNG with numbers from R's RNG stream
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 <spurdle.a at gmail.com> wrote:
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 transform the random numbers, as necessary. This may (?) benefit from a C/C++ implementation, but that can be kept separate from the random number generation. i.e. The C++ function takes a vector of random numbers from a uniform distribution, then computes "draws" (from the desired distribution), iteratively.