Is there an efficient algorithm to split up a number into N subsections so that the sum of the numbers adds up to the original, with a base minimum? For example, if
N
Well I've come up with something "just for fun".
It goes incrementally from minimum to number and populates an array with N sections using modulo and random.
minimum
number
See the jsFiddle here.
It won't work as expected if there are too many sections for this number. (ie number < N(N+1)/2)
number < N(N+1)/2