How generate random color using python?


I would like to highlight all walls based on their u-value. I can grab all the walls and group them by their u-value. That part goes very well. Now comes the hard part. How do I generate a random color?

I thinkthe right think is to use a python script to generate a random color.
I manage to find this on the internet Can anybody help me in getting the script to work in dynamo?

Would this suit your needs? Change the last one to the Revit counterpart of course.


Why use python when 2 lines of DS would do? :}



Thank you! I definitely think that I can use one of the two solutions.

how can I avoid using the same color twice?

I know this is a long time after, but if you don’t link the hard coded 255 value to the red, you will have more random colors. 255 to a, i255 to r, j 255 to g, k*255 to b.