Just got a easy way to do something like that, with any number of items, with different chances and any total chance. Example:
-
1 item has 40% chance, the result is 1 to 40.
-
1 item has 40% chance, the result is 41 to 80.
-
1 item has 10% chance, the result is 81 to 91
Sum all the chance, total is 91. Make a random of 1 to 100 (or to 91 if you want 100% chance) and see what item is in the range of the number sorted.