I like this better.
Code:
//new data structure:
var rarity ={ common: 6, uncommon:2, rare:2 };
var weapons ={ sword:4, bow:2, staff:2 };
It "reads" clearer (to me, at least!) and feels easier to make changes to. Actually, amazing how such a relatively minor rewrite helps the clarity so much.
But it still requires the user to understand the combinatorial math. Not at all difficult, but probably too much for a lot of the newbies we get here.