class Array # If +number+ is greater than the size of the array, the method # will simply return the array itself sorted randomly def randomly_pick(number) sort_by{ rand }.slice(0...number) end end
You need to create an account or log in to post comments to this site.