Multiple Custom RNG Outputs

So I need help in making a command that uses RNG to have a lot of possible outputs with different (custom) levels of rarity for the possible outcomes.
What I wanted specifically was to be able to use the command !loot and have the outcome be one of these emotes: bungieUNCOMMON, bungieRARE, bungieLEGENDARY, and bungieEXOTIC.

These are the probabilities/ rarity I wanted on the different possible outcomes:
bungieUNCOMMON : 6553/8192
bungieRARE : 1474/8192
bungieLEGENDARY : 164/8192
bungieEXOTIC : 1/8192

I have done a lot of testing but haven’t found anything that would let you customize the rarity of different outcomes. The only thing I could think of is a command that fetches the outcome from some kind of link but I have no idea what to use for this.

I would be so grateful to get some help with this, Thanks!

@shamario

Try this:

!addcom -cd=5 !loot $(eval a=Math.ceil(Math.random()*8192);if(a<=6553)b=`bungieUNCOMMON`;if(a>6553&&a<=8027)b=`bungieRARE`;if(a>8027&&a<=8191)b=`bungieLEGENDARY`;if(a==8192)b=`bungieEXOTIC`;b)

Holy cow!! It works so well!!! Thank you so so much! Perfect and you responded super quickly too! Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.