code: public T[] generateRandomCandidate(Random rng)
      {
          T[] candidate = elements.clone();
          List<T> list = Arrays.asList(candidate);
          Collections.shuffle(list, rng);
          return list.toArray(candidate);
      }
docs: Generates a random permutation from the configured elements.
  @param rng A source of randomness used to generate the random
  permutation.
  @return A random permutation.