public static <T> void shuffleArraySample(T[] array, int sampleSize) {
    if (array.length <= sampleSize) {
      return;
    }

    T temp;
    int index;
    Random random = new Random();

    for (int i = 0; i < sampleSize; i++) {
      index = random.nextInt(array.length - i) + i;
      temp = array[index];
      array[index] = array[i];
      array[i] = temp;
    }
  }
Create a random sample within the original array
app/com/linkedin/drelephant/math/Statistics.java