code: public DoubleVector[] chooseSeeds(int numCentroids, Matrix dataPoints) {
          int[] centroids = new int[numCentroids];
          // Select the first centroid randomly.
          DoubleVector[] centers = new DoubleVector[numCentroids];
          int centroidIndex = (int) Math.round(
                  Math.random()*(dataPoints.rows()-1));
          centers[0] = dataPoints.getRowVector(centroidIndex);
  
          // Compute the distance each data point has with the first centroid.
          double[] distances = new double[dataPoints.rows()];
          computeDistances(distances, false, dataPoints, centers[0]);
  
          // For each of the remaining centroids, select one of the data points,
          // p, with probability
          // p(dist(p, last_centroid)^2/sum_p(dist(p, last_centroid)^2))
          // This is an attempt to pick the data point which is furthest away from
          // the previously selected data point.
          for (int i = 1; i < numCentroids; ++i) {
              double sum = distanceSum(distances);
              double probability = Math.random();
              centroidIndex = chooseWithProbability(distances, sum, probability);
              centers[i] = dataPoints.getRowVector(centroidIndex);
              computeDistances(distances, true, dataPoints, centers[i]);
          }
  
          return centers;
      }
docs: Selects the best scattered {@link numCentroids} data points from {@link
  dataPoints}.  The actual {@link DoubleVector}s are returned, not a copy
  or wrapped version.