Remove unneeded empty check from WeightedRandom
This commit is contained in:
1 parent
95bf4efcf2
commit
b087e1fcd5
1 file changed
-3
@@ -23,9 +23,6 @@ public class WeightedRandom<E> {
|
||||
}
|
||||
|
||||
public E next(final Random random) {
|
||||
if (this.map.isEmpty()) {
|
||||
throw new IllegalStateException("No elements to select from");
|
||||
}
|
||||
return this.map.higherEntry(random.nextDouble() * this.total).getValue();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user