which.weight function

Sample an index of a vector weighted by the elements