Ensure tieBreaker is positive (#71)

Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE
http://findbugs.sourceforge.net/bugDescriptions.html#RV_ABSOLUTE_VALUE_OF_RANDOM_INT

Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
This commit is contained in:
champtar 2016-05-09 15:12:19 +02:00 committed by Ingo Bauersachs
parent 164ca04236
commit 7312077fd9

View File

@ -315,7 +315,7 @@ public class Agent
new BigInteger(128, random).toString(32), new BigInteger(128, random).toString(32),
/* min */ 22, /* max */ 256); /* min */ 22, /* max */ 256);
tieBreaker = Math.abs(random.nextLong()); tieBreaker = random.nextLong() & 0x7FFFFFFFFFFFFFFFL;
nominator = new DefaultNominator(this); nominator = new DefaultNominator(this);
} }