Source

RubyLearning / ProjectTrak / vendor / rails / activesupport / lib / active_support / core_ext / array / random_access.rb

Full commit
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