I know it’s called random, but the colors are chosen based on the object’s name. Just to add to the list of options there is an addon that comes with blender(F4/edit->preferences or Ctrl+comma in 4.0+. Then Click addons) called object color rules. This lets you assign rules for how colors are assigned. I don’t remember if you need to be set to object or random for the rules to apply. It’s a panel in the object tab of the properties editor.