Skip to content

Commit

Permalink
simplify initial rng slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Sep 7, 2024
1 parent c5b748e commit f1275d9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ static int getChance(@NotNull ChancedOutput<?> entry, @NotNull ChanceBoostFuncti
*/
static <I, T extends ChancedOutput<I>> boolean passesChance(int chance, T entry, @Nullable Map<I, Integer> cache) {
if (cache == null || !cache.containsKey(entry.getIngredient())) {
int initial = GTValues.RNG.nextInt(entry.getMaxChance() + 1);
int initial = GTValues.RNG.nextInt(entry.getMaxChance());
updateCachedChance(entry.getIngredient(), cache, initial);
return GTValues.RNG.nextInt(entry.getMaxChance()) <= entry.getChance();
return initial <= entry.getChance();
}

int fullChance = getCachedChance(entry, cache) + chance;
Expand Down

0 comments on commit f1275d9

Please sign in to comment.