<p>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.</p>
<div class="gmail_quote">On May 14, 2011 4:12 PM, "Chris DuBois" <<a href="mailto:chris.dubois@gmail.com">chris.dubois@gmail.com</a>> wrote:<br type="attribution"></div>