[Rd] Seeding non-R RNG with numbers from R's RNG stream
Abby Spurdle
@purd|e@@ @end|ng |rom gm@||@com
Fri Jul 31 06:00:40 CEST 2020
> 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.
More information about the R-devel
mailing list