[Rcpp-devel] Rcpp equivalent of sample()?

Douglas Bates bates at stat.wisc.edu
Sat May 14 23:33:52 CEST 2011

You can check what is done in R itself in the R sources but I imagine that
it uses a uniform random variate converted to an integer through the
cumulative probabilities. The good news is that it is easy to create the
cumulative weights with the std::accumulate function.
On May 14, 2011 4:12 PM, "Chris DuBois" <chris.dubois at gmail.com> wrote:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110514/f41295a0/attachment-0001.htm>

More information about the Rcpp-devel mailing list