Hey guys, how can I randomly generate a number of values which add up to a given value? So say I want 4 numbers that add up to 16: they could be (4, 4, 4, 4) or (10, 2, 2, 2) or (4, 3, 5, 4) etc etc. does anyone know a way of doing this efficiently? I would also like to be able to control how many of these numbers are allowed to be zero, if any.
Thanks in advance

however, the disadvantage is, that there are many repetitions in a list of output numbers.... maybe someone finds it useful....






