Need helping figuring out how to use the Random component with a list of domains

I have a list of domains, and for each domain item in that list I would like to get a random number. The sticking point is I’d like a different random number even if the same domain happens several times on the list. The list is generated parametrically to position several items, this means I don’t know ahead of time how many different domains I’ll end up with.

The thing is that whether I graft a tree or use a flat list, each domain gets the same random number. What I’d like is a random number for each line.

For example, for each of the domains that are 21 to -21, I’d like to have random number. Currently it gives me the same random number for all the 21 to -21 domains. Is there an efficient way to do this or do I have somehow figure out how to split up the domains as they come in and re-assemble the list?

Here is a screenshot of the current output

Get a number of random values equal to your domain count between zero and one and remap them to your domains:

2 Likes

Generate the same number of random seeds (0 to 300) as your list of domains:

1 Like

Thanks @dave_stasiuk that is exactly the kind of elegant solution I was hoping for, just clever enough for me to understand it. I was getting into some tom foolery with creating sets to pull out the individual domains, count them up, etc…overkill.

Thank you too @Joseph_Oster every time you post a solution I end up learning more about grasshopper and computational design itself, much appreciated.

1 Like