-
Method Summary
Modifier and TypeMethodDescriptionstatic void
shuffle
(byte[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(byte[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(byte[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(byte[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static void
shuffle
(char[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(char[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(char[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(char[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static void
shuffle
(double[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(double[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(double[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(double[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static void
shuffle
(float[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(float[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(float[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(float[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static void
shuffle
(int[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(int[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(int[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(int[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static void
shuffle
(long[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(long[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(long[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(long[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static void
shuffle
(short[] array) Randomizes the ordering of the elements of an array.static void
shuffle
(short[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(short[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static void
shuffle
(short[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.static <T> void
Randomizes the ordering of the elements of a List.static <T> void
Randomizes the ordering of the elements of a portion of a List.static <T> void
shuffle
(List<T> list, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements of a portion of a List.static <T> void
shuffle
(List<T> list, RandomGenerator gen) Randomizes the ordering of the elements of a List.static <T> void
shuffle
(T[] array) Randomizes the ordering of the elements of an array.static <T> void
shuffle
(T[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array.static <T> void
shuffle
(T[] array, int first, int last, RandomGenerator gen) Randomizes the ordering of the elements within a portion of an array.static <T> void
shuffle
(T[] array, RandomGenerator gen) Randomizes the ordering of the elements of an array.
-
Method Details
-
shuffle
public static void shuffle(byte[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(byte[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static void shuffle(char[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(char[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static void shuffle(double[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(double[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static void shuffle(float[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(float[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static void shuffle(int[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(int[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static void shuffle(long[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(long[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static void shuffle(short[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static void shuffle(short[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
public static <T> void shuffle(T[] array) Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Type Parameters:
T
- type of array elements- Parameters:
array
- the array to shuffle
-
shuffle
Randomizes the ordering of the elements of an array. All possible reorderings are equally likely.- Type Parameters:
T
- type of array elements- Parameters:
array
- the array to shufflegen
- the source of randomness
-
shuffle
public static <T> void shuffle(T[] array, int first, int last) Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Type Parameters:
T
- type of array elements- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shuffle- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements within a portion of an array. All possible reorderings are equally likely.- Type Parameters:
T
- type of array elements- Parameters:
array
- the array to shufflefirst
- the first element (inclusive) of the part of the array to shufflelast
- the last element (exclusive) of the part of the array to shufflegen
- the source of randomness- Throws:
ArrayIndexOutOfBoundsException
- if first is less than 0 or if last is greater than array.length
-
shuffle
Randomizes the ordering of the elements of a List. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Type Parameters:
T
- type of List elements- Parameters:
list
- the List to shuffle
-
shuffle
Randomizes the ordering of the elements of a List. All possible reorderings are equally likely.- Type Parameters:
T
- type of List elements- Parameters:
list
- the List to shufflegen
- the source of randomness
-
shuffle
Randomizes the ordering of the elements of a portion of a List. All possible reorderings are equally likely.This method uses ThreadLocalRandom as the pseudorandom number generator, and is thus safe, and efficient (i.e., non-blocking), for use with threads.
- Type Parameters:
T
- type of List elements- Parameters:
list
- the List to shufflefirst
- the first element (inclusive) of the part of the List to shufflelast
- the last element (exclusive) of the part of the List to shuffle
-
shuffle
Randomizes the ordering of the elements of a portion of a List. All possible reorderings are equally likely.- Type Parameters:
T
- type of List elements- Parameters:
list
- the List to shufflefirst
- the first element (inclusive) of the part of the List to shufflelast
- the last element (exclusive) of the part of the List to shufflegen
- the source of randomness
-