Skip to content

Instantly share code, notes, and snippets.

@swarley
Created November 16, 2012 05:32
Show Gist options
  • Save swarley/4084459 to your computer and use it in GitHub Desktop.
Save swarley/4084459 to your computer and use it in GitHub Desktop.
def dist(size, n)
m = size % n
d = (n-m) % size
([d]*(n-m)) + ([1]*(m))
end
p dist(10, 12)
# [2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment