Monster item drop,RPG game monster item drop

I want each monster to drop an item randomly with a drop rate percentage. It can drop only one item at a time. So I randomize a number between 0-100 and if it’s lower than a chance of an item it drops the most rare item possible. (For example: armor 50% helmet 30% weapon 5%. if the random num is 1 I get the weapon, if the num is 20 I get the helmet etc.). The problem is, those chances are not accurate, because I must get a num between 5-30 to get a helmet (which is 25%) and 30-50 to get an armor (which is 20%). Any other idea how to implement it?
here is my code in my DropItem() function:

  int rnd = Random.Range(0, 100);
 // Sort the list by drop rate (ascending order)
        
 // Drop the most rare item possible
 foreach (Item item in itemDrops){
 if (rnd < item.dropRate)
{
//drop
return;
}

Thank you!

Add the drop rate to the drop rate of all previous items:

int rnd = Random.Range(0, 100);
int totalDropRate =0;

 foreach (Item item in itemDrops){
      totalDropRate += item.dropRate;

       if (rnd < totalDropRate) 
                  //Drop
}

You also won’t need to worry about sorting them.

You can simply break out of the for loop once something has dropped