Houdini quick tip: random seed for your HDA instances

Sometimes you need each instance of an HDA to have a random seed for internal use. Sometimes you just can’t be arsed to do it yourself. This’ll do it – create a seed parameter in the UI, and then stick this in the onCreated handler to set it automatically on creation:

node = kwargs['node']
seed = 6173*node.sessionId()+4139;
node.parm('seed').set(seed % 10000)

From Leaf on the SideFX forums, who adds: “Explicitly setting the seed parameter on node create is the safest approach. Basing the seed on the node name can quickly cause problems when you go to clean up your scene and re-name everything (Toootally never accidentally done that before :)”

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti Robot Device *