File tree Expand file tree Collapse file tree 6 files changed +7
-10
lines changed
app/src/main/java/hexlet/code Expand file tree Collapse file tree 6 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 11package hexlet .code ;
22
33import java .util .Scanner ;
4+ import java .util .Random ;
45
56import hexlet .code .games .Calc ;
67import hexlet .code .games .Even ;
910import hexlet .code .games .Progression ;
1011
1112public final class Engine {
13+ public static final Random random = new Random ();
1214 private static int scoreCounter = 0 ;
1315 private static int scoreToWin = 3 ;
1416 private static StringBuilder correctAnswer = new StringBuilder ();
Original file line number Diff line number Diff line change 11package hexlet .code .games ;
22
3- import java . util . Random ;
3+ import static hexlet . code . Engine . random ;
44
55public final class Calc {
66
@@ -14,7 +14,6 @@ public static void startGameCalc() {
1414 }
1515
1616 public static String generateCorrectAnswer () {
17- Random random = new Random ();
1817 int correctAnswer ;
1918 int numberOne = random .nextInt (100 );
2019 int numberTwo = random .nextInt (100 );
Original file line number Diff line number Diff line change 11package hexlet .code .games ;
22
3- import java . util . Random ;
3+ import static hexlet . code . Engine . random ;
44
55public final class Even {
66
@@ -14,7 +14,6 @@ public static void startGameEven() {
1414
1515
1616 public static String generateCorrectAnswer () {
17- Random random = new Random ();
1817 StringBuilder correctAnswer = new StringBuilder ();
1918 final int evenDivisor = 2 ;
2019 final int oddRemainder = 1 ;
Original file line number Diff line number Diff line change 11package hexlet .code .games ;
22
3- import java . util . Random ;
3+ import static hexlet . code . Engine . random ;
44
55public final class GCD {
66
@@ -13,7 +13,6 @@ public static void startGameGCD() {
1313 }
1414
1515 public static String generateCorrectAnswer () {
16- Random random = new Random ();
1716 int numberA = random .nextInt (100 );
1817 int numberB = random .nextInt (100 );
1918 int numberC ;
Original file line number Diff line number Diff line change 11package hexlet .code .games ;
22
3- import java . util . Random ;
3+ import static hexlet . code . Engine . random ; ;
44
55public final class Prime {
66 private Prime () {
@@ -12,7 +12,6 @@ public static void startGamePrime() {
1212 }
1313
1414 public static String generateCorrectAnswer () {
15- Random random = new Random ();
1615 int number = random .nextInt (100 );
1716 int maxValue = (int ) (Math .ceil (Math .sqrt (number )));
1817 final int MIN_VALUE = 3 ;
Original file line number Diff line number Diff line change 11package hexlet .code .games ;
22
3- import java . util . Random ;
3+ import static hexlet . code . Engine . random ;
44
55
66public final class Progression {
@@ -18,7 +18,6 @@ public static void startGameProgression() {
1818 }
1919
2020 public static String generateCorrectAnswer () {
21- Random random = new Random ();
2221 int maxValue = 20 ;
2322 int minValue = 7 ;
2423 int numberOne = random .nextInt (100 );
You can’t perform that action at this time.
0 commit comments