E.g. a gun that fires a randomized projectile from a list.
Can this only be accomplished in .dlls?
Is there a function in RimWorld that can simply be referenced in XML to randomly pick from a list in XML?
No,
XML mod can only modified existing gameplay mechanics, and what you describe isn't at vanilla so you need to create that meachinc yourself with c#.
Thank you.