Skip to content

Commit

Permalink
Merge pull request #45 from BrekiTomasson/patch-1
Browse files Browse the repository at this point in the history
Update VillagerUtil.java
  • Loading branch information
OverlordsIII committed Oct 14, 2022
2 parents 1c3361f + ae953a0 commit 8bd84d2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ private static String upperFirstLetter(String string){

private static String pickRandomName(NamesConfig namesConfig) {
List<String> names = namesConfig.getNameList();
int index = random.nextInt(names.size());
int index = random.nextInt(names.size() - 1);
if (usedUpNames.size() > names.size()/2) {
usedUpNames.clear();
}
if (usedUpNames.contains(names.get(index))) {
index = random.nextInt(names.size());//Partial random, but you could possibly choose a name in the list again
index = random.nextInt(names.size() - 1); // Partial random, but you could possibly choose a name in the list again
}
usedUpNames.add(names.get(index));
return names.get(index);
Expand Down

0 comments on commit 8bd84d2

Please sign in to comment.