perf: this is just Math.min

This commit is contained in:
Breno A.
2024-06-09 09:56:58 -03:00
Unverified
parent dd9f59fbfc
commit 4b03304cdc
2 changed files with 2 additions and 2 deletions
@@ -104,7 +104,7 @@ public class GachaSystem extends BaseGameSystem {
}
total += weight;
}
int roll = ThreadLocalRandom.current().nextInt((total < cutoff) ? total : cutoff);
int roll = ThreadLocalRandom.current().nextInt(Math.min(total, cutoff));
int subTotal = 0;
for (int i = 0; i < weights.length; i++) {
subTotal += weights[i];