I can't comment on StefanKarpinski's answer b/c I don't have enough rep, but note that you can also use Distributions.DiscreteUniform(1,n) (for example) instead of 1:n. Worth mentioning b/c it's a formal distribution, which may have some advantages in certain cases.