Random Index from List(Subprogram)
I don't think you need to get this kind of convoluted node tree if you just want a random color.

The "Get Random Elements" node has a "Single" mode which will output a single randomly chosen value.

The setup :



Result :



If you just want a random index, you can use the "random" node with a floor math node.