I'm messing around trying to create treasure tables. Using the 5E DMG as an example, a treasure hoard may contain 2d6 Gems each priced at 50 gp. They also have a table of 12 different gems, each worth 50 gp. At the moment I only know how to either pull 2d6 unique gems (using a deck) or just pick one gem from a table and say you find 2d6 of them.
Is there an established method, or example, of how to pull quantities from a deck that add up to a given total? For instance:
[2d6] = 9 Total Gems => [1d4]=3x Gem A, [1d4]=2x Gem E, [1d4]=4x Gem D.
I'd imagine you'd need to use recursion but I'm not having any luck getting it to work. Is there a better way?