Unless it changed in 1.6, container entities don't randomize item type
I'm not sure how container entities work anymore since Entity Inspector became defunct. they used to not randomize item type at all but now it seems to be different. These shots are taken on the same character but at 2 different times - at level 39 and at level 50:
Corpse loot seems to be generated the same way as before. Gamepuppets with lootable corpses have items generated pseudo randomly from a themed dropbag. Think of these as loot tables.
For example, The maelstrom dropbag is assigned to maelstrom enemies and it contains a bunch of black biker type garments. The dropbag is padded out with a bunch of junk and consumables too.
The items you get are determined by a random seed whose state = world coordinates of the gamepuppet at the moment of death. So if you are looking for a very specific item in the wraith dropbag, you go out into the badlands, find a bunch of wraiths, save game state and then let them move around and kill them at different world coordinates. Load game state if you don't like the loot you get. If you kill an enemy at exactly the same world coordinates, they will always drop the same loot over and over, although not necessarily of the same quality level.
Item quality level is pseudo-randomly determined but using a different method. I don't know what the method is though. The relative percentages skew towards epic the closer to level 50 you are. I'm not aware of any non-boss corpses that can drop legendary items. I think if your character level can be higher than 50 then the drop chance will scale to a point where there is a non zero probability of legendary loot dropping on non-boss corpses though.