shuffleDeterministic static method

List<int> shuffleDeterministic(
  1. List<int> ar,
  2. List<int> seed
)

Implementation

static List<int> shuffleDeterministic(List<int> ar, List<int> seed) {
  for (int i = ar.length - 1; i > 0; i--) {
    int index = seed[i % seed.length] % ar.length;
    // Simple swap
    int a = ar[index];

    ar[index] = ar[i];
    ar[i] = a;
  }
  return ar;
}