On Tue, 13 Mar 2007 20:42:17 -0700, [EMAIL PROTECTED] wrote: > It should be possible to enumerate all sets of five numbers which sum > to 50 and randomly select one of them.
Of course it's possible. It's also a very inefficient way of doing so. For five numbers between 1 and 50, there are 50**5 = 312,500,000 possible sets to enumerate. Do you really think it is a good idea to generate over three hundred and twelve million lists, just to return one? The sole advantage of this method is that it will give "the most random" result, with the least amount of bias possible. But it isn't clear that the much more efficient fence-post method is any less random. See also the Subset Sum Problem: http://en.wikipedia.org/wiki/Subset_sum_problem -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list