I was doing a mission in Frostburn Canyon and when i opened one green box a Loot Midget jumped out of it and started attacking me. So i was wondering are locations and boxes in which Loot Midgets spawn fixed or can they randomly spawn from any box on any map?
Their locations are fixed, but their chance of spawning (and which midget you get, sometimes) is random. So a given container will always have a chance of giving a loot midget. For the containers they do appear in (they're rather rare) they have a high rate of spawning, maybe over 50%.
This is most easily tested in the Wildlife Exploitation Preserve in the room with the holding cells (where Bloodwing was before Jack moved her "somewhere dramatic"). There's 4 cardboard boxes in here, each with a loot midget...sometimes. Sometimes you can even get Jimmy Jenkins in the boxes, sometimes one or all of the midgets aren't there. More often than not though it seems all 4 spawn.