Package org.ddolib.util
Class ArraysUtil
java.lang.Object
org.ddolib.util.ArraysUtil
Utility class providing common array-related operations.
Currently, this class provides functionality to shuffle arrays of integers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidshuffle(int[] array) Randomly shuffles the elements of the given integer array in place.
-
Constructor Details
-
ArraysUtil
public ArraysUtil()
-
-
Method Details
-
shuffle
public static void shuffle(int[] array) Randomly shuffles the elements of the given integer array in place.This method implements the Fisher–Yates (Knuth) shuffle algorithm.
- Parameters:
array- the array of integers to be shuffled- Throws:
NullPointerException- if the input array isnull
-