# [PD] To divide a number in random parts

Markus Demmel az at zankapfel.org
Thu Mar 3 21:22:38 CET 2011

```You could try this approach(I also attached a patch with it):

48 = 4 * 10 + 1 * 8

so you use

n1=random(10)
n2 = 10 - n1

n3 = random(10)
n4 = 10-n3
.
.
n9 = random(8)
n10 = 8 - n9

On 03.03.2011 02:20, Caio Barros wrote:
> 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.
> 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 --------------
A non-text attachment was scrubbed...
Name: random_sum48.pd
Type: text/x-puredata
Size: 1317 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20110303/a54e71ac/attachment.bin>
```