rstate function

Pick a random state according to a vector of probabilities