Module: ActiveSupport::CoreExtensions::Array::RandomAccess

Included in:
Array
Defined in:
lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/random_access.rb

Instance Method Summary collapse

Instance Method Details

#randObject

Returns a random element from the array.



6
7
8
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/array/random_access.rb', line 6

def rand
  self[Kernel.rand(length)]
end