14
If you want an unbiased algorithm then the naive implementation is something like:
while (true) {
numbers = [];
total = 0;
for (i = 0; i < COUNT; ++i) {
next = rand(BOUNDS);
total += next;
numbers.push(next);
}
if (total == TARGET) {
return numbers;
}
}
This is non-terminating and slow but it is not biased. If you want a unbiased algorithm I'm not convinced the algorithms posted here are unbiased.