> 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. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel