We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 840b5ec commit 46fdaa6Copy full SHA for 46fdaa6
1 file changed
app/src/main/java/hexlet/code/Utils.java
@@ -0,0 +1,25 @@
1
+package hexlet.code;
2
+
3
+import java.security.SecureRandom;
4
5
+public class Utils {
6
+ private static final SecureRandom RND = new SecureRandom();
7
8
+ public static int intRnd(int value1, int value2) {
9
10
+ if (value1 == value2) {
11
+ return value1;
12
+ }
13
14
+ int minValue = Integer.min(value1, value2);
15
+ int maxValue = Integer.max(value1, value2);
16
17
+ int range = maxValue - minValue + 1;
18
19
+ return RND.nextInt(range) + minValue;
20
21
22
+ public static int intRnd(int value) {
23
+ return intRnd(0, value);
24
25
+}
0 commit comments