Skip to content

Commit df73f5e

Browse files
fixed utils (examplehub#114)
1 parent 5c81396 commit df73f5e

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

src/main/java/com/examplehub/utils/RandomUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static int[] randomInts(int min, int max, int count) {
1919
int[] ints = new int[count];
2020
Random random = new Random();
2121
for (int i = 0; i < count; ++i) {
22-
ints[i] = random.nextInt(max - min + 1) + min;
22+
ints[i] = min + random.nextInt(max - min + 1);
2323
}
2424
return ints;
2525
}

src/main/java/com/examplehub/utils/SortUtils.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,4 @@ public static <T extends Comparable<T>> boolean isSorted(T[] array) {
3232
}
3333
return true;
3434
}
35-
36-
/**
37-
* Swapped array elements at different index.
38-
*
39-
* @param numbers the numbers to be swapped.
40-
* @param i the first index.
41-
* @param j the second index.
42-
*/
43-
public static void swap(int[] numbers, int i, int j) {
44-
int temp = numbers[i];
45-
numbers[i] = numbers[j];
46-
numbers[j] = temp;
47-
}
48-
49-
/**
50-
* Generic swapped array elements at different index.
51-
*
52-
* @param numbers the numbers to be swapped.
53-
* @param i the first index.
54-
* @param j the second index.
55-
* @param <T> the class of the objects in the array.
56-
*/
57-
public static <T extends Comparable<T>> void swap(T[] numbers, int i, int j) {
58-
T temp = numbers[i];
59-
numbers[i] = numbers[j];
60-
numbers[j] = temp;
61-
}
6235
}

0 commit comments

Comments
 (0)