public int splitRandomly(ArrayModifiableDBIDs ind,int begin,int end,DoubleDataStore tpro,Random rand){
  final int nele=end - begin;
  DBIDArrayIter it=ind.iter();
  double rs=tpro.doubleValue(it.seek(begin + rand.nextInt(nele)));
  int minInd=begin, maxInd=end - 1;
  while (minInd < maxInd) {
    double currEle=tpro.doubleValue(it.seek(minInd));
    if (currEle > rs) {
      while (minInd < maxInd && tpro.doubleValue(it.seek(maxInd)) > rs) {
        maxInd--;
      }
      if (minInd == maxInd) {
        break;
      }
      ind.swap(minInd,maxInd);
      maxInd--;
    }
    minInd++;
  }
  if (minInd == end - 1) {
    minInd=(begin + end) >>> 1;
  }
  return minInd;
}

public int splitRandomly ( ArrayModifiableDBIDs ind , int begin , int end , DoubleDataStore tpro , Random rand ) { final int nele = end - begin ; DBIDArrayIter it = ind . iter ( ) ; double rs = tpro . doubleValue ( it . seek ( begin + rand . nextInt ( nele ) ) ) ; int minInd = begin , maxInd = end - 1 ; while ( minInd < maxInd ) { double currEle = tpro . doubleValue ( it . seek ( minInd ) ) ; if ( currEle > rs ) { while ( minInd < maxInd && tpro . doubleValue ( it . seek ( maxInd ) ) > rs ) { maxInd -- ; } if ( minInd == maxInd ) { break ; } ind . swap ( minInd , maxInd ) ; maxInd -- ; } minInd ++ ; } if ( minInd == end - 1 ) { minInd = ( begin + end ) > > > 1 ; } return minInd ; }
split the data set randomly .
