Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The probability was very slightly off when calculating drop chances. The previous code generated a random integer between 0 (inclusive) and 999,999 (exclusive), when both bounds should have been inclusive. This is based on the assumption that a drop chance of 100,000 should correspond to 10%. Previously there were 999,999 possible values that could be generated (all of the integers from 0 to 999,998), and 100,000 of them were less than 100,000 (all of the integers from 0 to 99,999), so since every integer is equally likely to be generated this gave a 100,000 / 999,999 probability of dropping the item, which is very slightly more than 0.1. This difference is small enough to be negligible, which is probably why it wasn't caught. Increasing the upper bound of the randomly generated number by 1 fixes this.
Additionally, the code which determined the quantity of items dropped when the maximum quantity was greater than 1 always gave a number less than the maximum, and didn't work at all if the max and min were equal. Adding 1 to the bound of the randomly generated number fixes this as well, as shown by the unit test. Also removed the de.Maximum != 1 check since this is not necessary with the fix.
Checklist before requesting a review