GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
I recently added in the 1.6.0 release of Moses (a utility-belt library for Lua I am maintaining), two utility functions: sample and sampleProb.
The first one will pick randomly one value in a supplied list. We can even specify a certain number of values to pick. It roughly works as davisdude suggested.
The latter might be slightly more interesting, as it performs probabilistic sampling . It considers every single element in the array and given a probability, will decide (randomly) if the element should be part of the returned sample or not.