In <[EMAIL PROTECTED]>, cesco wrote: > Given two positive integers, N and M with N < M, I have to generate N > positive integers such that sum(N)=M. No more constraints.
Break it into subproblems. Generate a random number X from a suitable range and you are left with one number, and the problem to generate (N-1) random numbers that add up to (M-X). You have to think a little bit about the "suitable range" part though. The necessary functions to draw random numbers are in the `random` module. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list