1010: Fixed the two remaining SonarCloud errors (#1023)

The two remaining files were still creating a Random everytime the method
was called. These were missed in the previous commit because the previous
commit had fixed only one of the methods; in other words, there were
multiple methods that were creating the Random object on each call.
This commit is contained in:
Christopher O'Connell 2019-10-20 02:02:36 -04:00 committed by Ilkka Seppälä
parent f671f03d13
commit 82f9a6c232
2 changed files with 2 additions and 4 deletions

View File

@ -102,8 +102,7 @@ public class SampleData {
} }
private static PlayerDetails getRandomPlayerDetails() { private static PlayerDetails getRandomPlayerDetails() {
Random random = new Random(); int idx = RANDOM.nextInt(PLAYERS.size());
int idx = random.nextInt(PLAYERS.size());
return PLAYERS.get(idx); return PLAYERS.get(idx);
} }
} }

View File

@ -71,8 +71,7 @@ public class CellPool {
} }
void addNewCell(Cell c) { void addNewCell(Cell c) {
Random rand = new Random(); c.candy = randomCode[RANDOM.nextInt(randomCode.length)]; //changing candytype to new
c.candy = randomCode[rand.nextInt(randomCode.length)]; //changing candytype to new
this.pool.add(c); this.pool.add(c);
pointer++; pointer++;
} }