[PD] To divide a number in random parts
Mathieu Bouchard
matju at artengine.ca
Fri Mar 4 02:54:06 CET 2011
On Thu, 3 Mar 2011, Caio Barros wrote:
> It's funny that you said that. I slept over this problem and yes, I want
> the chords to have a minimun and maximun duration.
Ok. Give every chord the minimum duration, then pick random amounts of
extra time to add to each, between zero and the difference between the
minimum and the maximum.
If you use Tim's solution, the minimum and maximum will be scaled randomly
because the sum of all random numbers is itself a random number.
Thus you if you reserve minimum time separately and use Tim's solution on
the time that hasn't been allocated yet, the minimum will be exactly
respected, whereas the maximum won't.
Now, to make the maximum respected, it has to be another solution than
that, and to control the likelihood of getting something close to a
maximum duration, it's also something else (if you have several delays
close to the maximum before scaling, they won't be close to the maximum
after the scaling, if it's a downwards scaling).
The problem of having three delays from 0 to M so that the sum is equal to
M is the problem of picking a random place in a right triangle. If the sum
has to be N (another number bigger than M), then it's a bigger right
triangle with cut corners.
When you have four delays, it's about picking a random place in a
triangular pyramid.
When you have more delays, you'd need a space with more than three
dimensions to think about it.
_______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
More information about the Pd-list
mailing list