Ideas
I'm seeing this in my game, except that I don't think that the hats are random - they're leftover from previous situation outfits that sim might have been wearing.
This sim is currently acting as the lawyer at a Ravenwood festival, but the lawyer outfit doesn't normally need a hat. Previously, when a sim would spin into a new situation outfit it would clear previous hats. Now, it seems to retain whatever they previously had on - that cap is from a tourist outfit, because the last thing she appeared as was a tourist sim in San Myshuno.
I'm seeing it most obviously in Britechester, where other students appearing at events have the mascot head on, because they were previously appearing as a mascot, but the headpiece isn't removed when they spin into other student outfits like sports team uniforms or uni clothing for the school spirit party or the debate team - they all still have lobster or dragon heads on.