I would like to ask if the following can be achieved (red group)?
Analyze a list for its total number of items (x)
Define a specific number sub-groups (y)
Arbitrary random distribution of (x) by (y)
the sum of the sub-groups (y) should total the number of items if (x)
I have attached a solution for a discrete value in each of the sub-group (green group) but want to know if GH could randomize these values based on the criteria above.
This kind of works…? by thinking about it as a math problem.
I also have noticed if I change the slider in (Y) to “6” I get a total sum of 101 and not 100? not sure why that is happening.
I would like to ask the experienced GH users and/or the more proficient at mathematics if a “better” and more efficient solution exists. A component, expression or some other coded script perhaps?
There is the possibility that there could be duplicates in the random numbers,depending on the seed, so I included the Delete Consecutive component to alert you.
I was playing around with it and realized that it was not working under all circumstances, I was just “lucky”. Here’s a revised version, which of course, is that much more complicated.
Also, the more random numbers you generate, the more likely you’re going to have duplicates.I’m thinking this is something probably better done programmatically, where you can loop to your heart’s content until you find a suitable list without duplicates.
Hmmm. I see what you mean. It appears to work up until about 12 and then starts to output mismatched lists. Same applies to the seed - but its not as bad. It does work as long as I know where the errors are hiding and avoid them.
I do like your approach - its getting me to think some more, so thank you for that. I appreciate your time in helping.