Removed potential integer overflow.

If the number passed into max is Integer.MAX_VALUE, like it is with
ChoiceOfDamnation, the random number will overflow. So let's not do
that.
This commit is contained in:
Nathaniel Brandes 2017-03-08 21:41:57 -08:00
parent 4a9eddb724
commit 2ecb415b4d

View file

@ -1543,7 +1543,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
//TODO: improve this
if (min < max && min == 0) {
return RandomUtil.nextInt(max + 1);
return RandomUtil.nextInt(max);
}
return min;
}