How is the loot chance calculated?

I'm looking at the plugin and trying to read how it's calculated, but i'm not too versed on how this programming language works.

I know the current rarity scale is a globally affecting one that changes loot rarity from 0-4, but what's the drop chance for 1,2,3, and 4? There's a lot of items that i'd love to have still spawn, albiet an insanely low droprate, and 1-4 doesn't really tell much nor does it allow me to have something at an extreme droprate.

For example, if I had a container that had only two items in the drop pool, with a limit of 1 item per container, and I set item A to rarity 1, and item B to rarity 4, what would be the drop chance of the two? It seems like it's some sort of dynamic drop system that calculates based off of the rarity value and the amount of items in the table. As cool as it is, it doesn't really aid well into telling you drop chances.