Maximizing curve division with random/repeated distances

I aim to divide a curve using numbers and a random repetition. The division of the curve varies based on the seed in the Jitter. Sometimes the last segment is long enough to extract one of the input distances. By manipulating the Jitter seed, I achieve the maximum division of the curve. How can i automate this process?

And this is the script:

Maximum Crv (8.4 KB)

I don’t know what you mean by “automate this process”? Your Crv param is not internalized.

Why do you Text Join the list of numbers from Jitter?
And then Text Split them? Which inserts zeros and doubles the length of the list?
Why use Dash?

I would approach the question something like this:

Crv (10.4 KB)

Hi Joseph,

Thank you for your response. I am asking about how to maximize the curve division without adjusting the seed value. Is there a way to do this?

Not easily, that I can think of at the moment, no. I suppose you could delete the last two segments (the short one and the last valid one), then find the largest slider value that fits in the remaining gap.

I suppose it’s possible somehow to specify how many of each slider value is needed to get a sum that is close to your curve length but at the moment, I don’t know how. I guess you’d have to specify a range of possible repeat values… Sounds way too complicated, what’s the point?

The curve I used was a straight line of arbitrary length. Your Crv param should be internalized.

P.S. You could use brute force - run the code for all seed values from 0 to 300 (integers) and see which one is longest, not counting the short one at the end.

P.P.S. The ridiculous brute force method. Looks like 82 integer values between 0 to 300 result in the same maximum length value. SILLY! :crazy_face:

Crv (16.5 KB)