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:
parent
f671f03d13
commit
82f9a6c232
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user