Class Arrays

java.lang.Object
io.jenetics.internal.util.Arrays

public final class Arrays extends Object
Helper class which contains array helper methods.
Since:
3.0
Version:
3.0
  • Method Details

    • swap

      public static <T> void swap(T[] array, int i, int j)
    • swap

      public static void swap(int[] array, int i, int j)
    • swap

      public static void swap(long[] array, int i, int j)
    • swap

      public static void swap(double[] array, int i, int j)
    • revert

      public static <T> T[] revert(T[] array)
    • revert

      public static int[] revert(int[] array)
    • revert

      public static long[] revert(long[] array)
    • revert

      public static double[] revert(double[] array)
    • shuffle

      public static double[] shuffle(double[] array, RandomGenerator random)
      Randomize the array using the given RandomGenerator 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 shuffle
      random - the PRNG
      Returns:
      the shuffled array
    • shuffle

      public static int[] shuffle(int[] array, RandomGenerator random)
    • add

      public static int[] add(int[] array, int b)
    • rangeCheck

      public static void rangeCheck(int from, int to)