aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/random_access.rb
blob: 67c322daea5086ed4664902ee75933f2cd323d16 (plain) (tree)
1
2
3
4
5
6

                                            
                    
                             
     
  
class Array
  # Returns a random element from the array.
  def random_element
    self[Kernel.rand(length)]
  end
end