How does vendor restocking work in Fallout 4?
Solution 1:
You have three highly related questions that I'll address separately:
Do vendors restock on a random selection of items with some being more likely than others?
In my experience, merchants don't always stock everything that they might stock. This is especially evident with junk merchants. For instance, sometimes Carla has duct tape. Sometimes she doesn't.
The only solid reference to this I've found was on Nukapedia, referring to Alexis Combes' stock of shipments:
Unlike other merchants who offer shipments, Alexis Combes always has only one shipment available at any given time, but which item is in the shipment changes. Saving the game before trading with her allows you to load that save for a different shipment, or you can wait/sleep for 48 hours.
I don't know about likelihood. It's at least possible that every item in the merchant's list is equally likely and they just choose a certain number, but it's also possible that there are weights associated with items that affect probability. Looking over the Leveled List and Leveled Item entries on the wikis for modding Oblivion and Fallout 3 leads me to believe that each item within a leveled list that is of the appropriate level is equally likely, but I can't say for sure.
Some items are always present, such as certain unique items like The Overseer's Guardian at Alexis Combes' shop, so there's at least a distinction between random and permanent.
The quote from Nukapedia about shipments implies that you could keep loading and sleeping for 48 hours until you find the ammo you're looking for. Apparently you could just save and load before initiating the trade dialog as well, which I find surprising.
Is there a max limit to how many different items a vendor will sell so that no new items will be added to stock after this limit is reached?
I'm not 100% sure what you're asking here.
The merchant's stock will reset each cycle whether you buy anything or not. It's possible that the merchant always stocks the exact same number of items each time, but I don't know that that really matters in any useful way.
Is there a level limit on what items can be restocked? I bought 2mm EC ammunition once from Arturo so I assume I'm high enough level if that's the case?
I believe this is the case, but I'm having a hard time getting a definitive reference for it.
There are definitely leveled lists in the game which affect drops. For instance, Nukapedia's Combat Armor article says
Combat armor is considered "Tier 3" and becomes more common as you enter into the middle levels (15-35).
I assume this is also the case for merchants, and I feel like the items offered at a particular merchant get better as the game progresses. In particular, I think I find better mods for my laser weapons over time, even going back to the same vendor.
I can find explicit references on the G.E.C.K. (Fallout 3 modding) to leveled item lists for vendors. The Elder Scrolls Construction Set Wiki (Oblivion modding) gives me the impression the same thing is done there, but I can't find an explicit indicator. This implies that the same thing exists in Fallout 4, but of course doesn't prove it.
There's no reason to think that different rules would be used to generate the merchant's inventory the first time you speak with them than at any later point, so yes I'm pretty certain that if you were high enough level to get the item once, then it's at least possible for it to show up again.
The only way this would not be the case is if the item was added to the merchant's inventory explicitly, rather than on a leveled list, and was not set to respawn, like a unique legendary item would have been.