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++.
Value between 1 and n
Albert Y. Kim
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.