File tree 2 files changed +3
-62
lines changed
src/main/java/com/thealgorithms 2 files changed +3
-62
lines changed Original file line number Diff line number Diff line change 1
1
package com .thealgorithms .misc ;
2
+
2
3
import java .util .Random ;
4
+
3
5
/**
4
6
* The Fisher-Yates (Knuth) Shuffle algorithm randomly permutes an array's
5
7
* elements, ensuring each permutation is equally likely.
@@ -18,6 +20,7 @@ public final class ShuffleArray {
18
20
// Prevent instantiation
19
21
private ShuffleArray () {
20
22
}
23
+
21
24
/**
22
25
* This method shuffles an array using the Fisher-Yates algorithm.
23
26
*
@@ -32,15 +35,4 @@ public static void shuffle(int[] arr) {
32
35
arr [j ] = temp ;
33
36
}
34
37
}
35
- /**
36
- * This method prints the elements of the array.
37
- *
38
- * @param arr is the input array to be printed
39
- */
40
- public static void printArray (int [] arr ) {
41
- for (int num : arr ) {
42
- System .out .print (num + " " );
43
- }
44
- System .out .println ();
45
- }
46
38
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments