number generator

Mel Wilson mwilson at the-wire.com
Sat Mar 10 17:36:58 CET 2007


Gerard Flanagan wrote:
> On Mar 9, 4:17 pm, "cesco" <fd.calabr... at gmail.com> wrote:
>> On Mar 9, 3:51 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
>>
>>> "cesco" <fd.calabr... at gmail.com> writes:
>>>> I have to generate a list of N random numbers (integer) whose sum is
>>>> equal to M. If, for example, I have to generate 5 random numbers whose
>>>> sum is 50 a possible solution could be [3, 11, 7, 22, 7]. 
> 
> Suppose you have a fixed telegraph pole at N and a fixed telgraph pole
> at M, and you're given 5 more telegraph poles...
> 
That's a good one!  Three-liner.

	Cheers,		Mel.




More information about the Python-list mailing list