Steven D'Aprano <[EMAIL PROTECTED]> writes: > > 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.
No there are only 2611 such sets and generating them takes about 0.5 seconds on my laptop. I posted the code for this elsewhere in the thread. -- http://mail.python.org/mailman/listinfo/python-list