Random number seeding in clusters

Hi There,

I have a cluster where I would like to have random behaviour, and there are multiple instances of the cluster used in the definition. Is there a way to seed the random number generator differently for each instance of the cluster, or is it essential to generate the seed outside the cluster and pass it through as a cluster input? In other words, is there some sort of ‘cluster-instance-variable’ that I can access and use as a local seed?

Many thanks in advance,


Hi @bob.h.mackay,

You can for instance put this custom GHPython component in each instance of the same cluster (or different clusters). It generates a single, unique random integer that you can use to seed the Random components inside the clusters. All instances of this custom component generate a unique number that is guaranteed to vary from the numbers computed by the other instances of this component in your scene.
You can set the Seed of each of these to fix their random outputs.

2020-12-14 10-42-47.2020-12-14 10_44_50

Once you change the Seed of a component or want to output a new value, you need to hit Reset for things to recompute.

unique_random_numbers.gh (6.1 KB)

1 Like

Whoosh! Thank you very much indeed - I will have a go with this!