mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-04 16:13:42 +00:00
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:
1 parent
f671f03d13
commit
82f9a6c232
2 files changed
+2
-4
No files matched your search
@@ -102,8 +102,7 @@ public class SampleData {
|
||||
}
|
||||
|
||||
private static PlayerDetails getRandomPlayerDetails() {
|
||||
Random random = new Random();
|
||||
int idx = random.nextInt(PLAYERS.size());
|
||||
int idx = RANDOM.nextInt(PLAYERS.size());
|
||||
return PLAYERS.get(idx);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user