Let's say I am working on a game in C# and want to give the player ability to open a loot box. Let's say we have 5 tiers of rarity for all items in the game. Common - 60%, Uncommon- 20%, Epic - 7.5%, Special - 7.5% Legendary - 5%
Most code I see online says to generate a random number between 1 and 100 for example, and then compare that random number to each rarity until you get a hit.
However, how could this be possible of "Epic" and "Special" both have the same probability? Let's say the random number is 6. How do I know if I should give them a special or an Epic? What I really want is there to be a 7.5% chance that epic and also a 7.5% chance that 'special' can be obtained. How do I do that?
Aucun commentaire:
Enregistrer un commentaire