[PD] To divide a number in random parts

tim vets timvets at gmail.com
Thu Mar 3 08:03:41 CET 2011

2011/3/3 Caio Barros <caio.barros at gmail.com>

> Hey guys, long time since I posted here.
> I've been trying to think a way to divide a number into random parts.
> Let me explain myself better:
> I'm writing a piece where I want 10 chords played during 48 seconds but the
> duration of each chord should be different.
> So I'm trying to figure out a way to divide 48 into 10 unequal parts, I
> think using random numbers should be the best way but the difficulty is to
> get 10 random numbers wich summed give 48.

take n random numbers and sum them (n1+n2+n3+...=sum)
divide 48 by that sum (48/sum=x)
multiply each of your n random numbers by x and sum that to get 48
(n1*x + n2*x + n3*x +...=48)

> Since I'm not expert at math maybe someone can help me.
> I want to do this operation with other numbers, therefore a pd patch would
> be great.
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20110303/e6df090b/attachment.htm>

More information about the Pd-list mailing list