In the 1.0.8.6 TF2 update, Valve implemented a new policy that prevents server modifications from attaching entities to players, as of this update entities attached to the player are invisible to players.
It would be hats in your inventory I believe, not random hats throughout the entire game. If that makes any difference.
Not sure if such a plugin is possible to make, or if it exists.
No dice on this for now, as I have no idea how I'd equip random hats on players.
ultimate necropostAdd linux_lover, he's the creator of randomizer. It works on his servers.