Forums > MaxMSP

A requested number of random numbers giving a certain sum

Oct 29 2011 | 4:53 pm

Is it possible within Max to generate a certain number of random numbers giving a desired sum ?

For instance :
9 numbers (from 50) giving a sum of 2640 ?

Thanks in advance,


Oct 29 2011 | 11:10 pm


this is in fact not a Max, but a general math question. You have to find out how you want to get those random numbers, then you can do it with Max… Either you can take random values and then scale them in order to keep their sum constant; or you can generate the random numbers one-by-one and decrease the random domain after each step in order to make sure that the sum of the numbers would still remain constant; or you find some other way to go. After finding out the proper solution for your particular case, you can go and create a patch that realizes that particular solution.

Hope this helps,

Oct 29 2011 | 11:25 pm

i would go the route to scale stuff to a range from 0. 1.

Nov 01 2011 | 5:47 pm

A million thanks to you guys !

Nov 02 2011 | 8:43 am

btw, i just played a bit with that query – of course you must also ask yourself what distribution you want.

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > MaxMSP