java.lang.Object
io.jenetics.internal.util.Arrays
Helper class which contains array helper methods.
- Since:
- 3.0
- Version:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]
add
(int[] array, int b) static void
rangeCheck
(int from, int to) static double[]
revert
(double[] array) static int[]
revert
(int[] array) static long[]
revert
(long[] array) static <T> T[]
revert
(T[] array) static double[]
shuffle
(double[] array, RandomGenerator random) Randomize thearray
using the givenRandomGenerator
object.static int[]
shuffle
(int[] array, RandomGenerator random) static void
swap
(double[] array, int i, int j) static void
swap
(int[] array, int i, int j) static void
swap
(long[] array, int i, int j) static <T> void
swap
(T[] array, int i, int j)
-
Method Details
-
swap
-
swap
-
swap
-
swap
-
revert
-
revert
-
revert
-
revert
-
shuffle
Randomize thearray
using the givenRandomGenerator
object. The used shuffling algorithm is from D. Knuth TAOCP, Seminumerical Algorithms, Third edition, page 142, Algorithm S (Selection sampling technique).- Parameters:
array
- the array to shufflerandom
- the PRNG- Returns:
- the shuffled array
-
shuffle
-
add
-
rangeCheck
-