This uses the RcppArmadillo implementation of the sample() command to draw a sample of size 1 from 0:(n-1) given probability vector p of length n. This is used for sampling interal to an Rcpp method, and its start index is 0 to match vector indexing in C++.

1 | ```
ProbSampleReplace(prob)
``` |

`prob` |
Probability vector |

Value between 1 and n

Albert Y. Kim

1 2 | ```
p <- rep(0.2, 5)
ProbSampleReplace(p)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.