Hoping someone can help with this, I found this post which was almost 10 years old! It seems that it will do what I need, but it errors on line 27
With "Error 1220 Illegal Argument color.rbg["hexValue"]=part[1];

A little late to the party here...stumbled across your question and thought I'd share something I created recently that will do a similar thing.

This script will create a solid color layer with a random color from a series of pre-selected hex codes...so the idea is you populate the array with hex vals for colors you want it to choose from and then it'll randomly pick one of those colors for each iteration of the loop.

The loop is determined by 'n'. Change the value of n to however many files you want it to create and that's it; hit play and walk away