documentcloud/underscore — pull request #963 by vincentwoo (2013-02-04 08:12:01+00:00)
Title: Add _.sample(array, number) functionality to underscore.js

Ruby's [Array#sample](http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-sample) method is extremely useful to me, at least as useful as shuffle.

I've replicated that functionality here in underscore and added a test. One thing I'm not sure if I should have done was make this work with javascript objects as well as arrays. Most of ujs' functions work across they keys/values of arbitrary objects, and I wasn't sure if it was right to do that here, or what exactly that should look like if I did.

Please advise if this is up to scratch, and thanks for the great library.