I was trying to do it with python scripting but without success. At first, the maximum I could do was a script to create a random color for every material with a name starting with "rnd" and it was quite simple, but it needs a different material for each object.
import bpy, random
for mat in a:
But after thinking about it for a few hours, I finally came with a solution, by extracting 3 random values from the random value of the object. So if the random number is for example 0.123456, I take the value of 0.12 for R, 0.34 for G and 0.56 for B. I think it is ok as you can test with this example image. You can try it by yourself with the node group in this Blend file.