vendredi 18 octobre 2019

I want to make random choice but with weights for its values

I'm making an RPG loot generator, and I'm trying to make a random choice with weights for each rarity of items. How do I do that?

Item_rarity = ["Common", "Uncommon", "Superior", "Rare", "Legendary"] Rarity_choice = random.choice(Item_rarity)

I expect that common = 50% ; Uncommon = 30% ; Superior = 14% ; Rare = 5% ; Legendary = 1%. How do I do that?




Aucun commentaire:

Enregistrer un commentaire