aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/random_access.rb
blob: 54d17cbf30111ad758caab37ce6cc457ef0edd1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Array #:nodoc:
      module RandomAccess
        # Returns a random element from the array.
        def rand
          self[Kernel.rand(length)]
        end
      end
    end
  end
end