code: public static void shuffle (
          byte[] values, int offset, int length, Random rnd)
      {
          // starting from the end of the specified region, repeatedly swap
          // the element in question with a random element previous to it
          // (in the specified region) up to and including itself
          for (int ii = offset + length - 1; ii > offset; ii--) {
              int idx = offset + rnd.nextInt(ii - offset + 1);
              byte tmp = values[ii];
              values[ii] = values[idx];
              values[idx] = tmp;
          }
      }
docs: Shuffles a subset of elements within the specified array into a random sequence.
  
  @param values the array containing elements to shuffle.
  @param offset the index at which to start shuffling elements.
  @param length the number of elements to shuffle.
  @param rnd the source from which random values for shuffling the array are obtained.