Random material applied to families

Hi all,

I’m a dynamo newbie and started to mess around it a couple weeks ago.

Today i faced a problem: i needed to define some materials i had previously chosen to some families in a random way.

Even though i managed to solve my issues, i still think that there might be a better way of doing it.

Does anyone have any tips to help me in this task?

Thank you in advance,