class Array

From stackoverflow.com/questions/11903839/algorithm-to-spread-selection-over-a-fixed-size-array

Public Instance Methods

spread(n) click to toggle source
# File lib/core_ext/array.rb, line 3
def spread(n)
  step = self.length.to_f / n
  array = (0..(n - 1)).to_a.collect{|i| self[(i * step)]}.uniq
end