"Siddhartha " <firstname.lastname@example.org> wrote in message news:email@example.com... > Thank you! This is awesome. > > > But I also foresee that this problem will extend for me to 20 variables.
I would process the variables in decreasing order of maximum value, and stop processing when you know that none of the possible combinations of values for the remaining variables can satisfy your sum constraint. That should allow you to cut out significant chunks of the combination space.
> Also, we may eventually get enough information to model the random numbers > as continuous.
That's different; I believe there are some submissions on the File Exchange for this case. Take a look at RANDFIXEDSUM.