This is an example -Give credit when using!!!! This removes all that hassle of when you create a new rarity to change all the chances of everything.
All code done by me. This isn't supposed to be a game, just an example for usage. The code looks complex at first but it's not really that bad.