I had an application that required something similar to the problem described here.
I too need to generate a set of random variables {Xi} that add up to a given sum S