But yeah, lots lots of work and I don't see how it could be implemented for the use of an user. How exactly would spawning a weapon work.
There'd probably be like a sort of base gun where there's a sort of universal model for the item datablock; for example, an AK47 model for any randomly generated AK-type weapons, be it a shotgun or an SMG. That being said, every weapon would probably end up having to have a base gun for it, probably based off real life weapons like the AK47 mentioned before and AR15s, AR18s, etc.
however, when you equip it, a script runs with the "Activate" sequence that randomizes the gun by hiding/unhiding different nodes (if the bot approach is taken) and randomizes the stats accordingly, as well as saving the randomizations, however that'd be done, and changing and saving a variable to check whether the gun has been randomized already or not, so that the gun is the same when it's dropped and picked up.
if the gun gets a sight as a random modification then whatever statistics would carry over to the sighted-in datablock with whatever necessary variable changes such as decreased spread, etc.