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

Included in:
Array
Defined in:
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/active_support/core_ext/array/random_access.rb', line 6

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