File tree Expand file tree Collapse file tree 2 files changed +3
-62
lines changed
src/main/java/com/thealgorithms Expand file tree Collapse file tree 2 files changed +3
-62
lines changed Original file line number Diff line number Diff line change 11package com .thealgorithms .misc ;
2+
23import java .util .Random ;
4+
35/**
46 * The Fisher-Yates (Knuth) Shuffle algorithm randomly permutes an array's
57 * elements, ensuring each permutation is equally likely.
@@ -18,6 +20,7 @@ public final class ShuffleArray {
1820 // Prevent instantiation
1921 private ShuffleArray () {
2022 }
23+
2124 /**
2225 * This method shuffles an array using the Fisher-Yates algorithm.
2326 *
@@ -32,15 +35,4 @@ public static void shuffle(int[] arr) {
3235 arr [j ] = temp ;
3336 }
3437 }
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- }
4638}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments