Skip to content

Instantly share code, notes, and snippets.

@wishdev
Created September 1, 2009 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wishdev/179241 to your computer and use it in GitHub Desktop.
Save wishdev/179241 to your computer and use it in GitHub Desktop.
class Array
def spread(members)
ret = Array.new
dist = count.to_f/(members-1)
(members-1).times{ |pos|
ret << at((pos*dist).floor)
}
ret << at(-1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment