public Instances resample(Random random){
  Instances newData=new Instances(this,numInstances());
  while (newData.numInstances() < numInstances()) {
    newData.add(instance(random.nextInt(numInstances())));
  }
  return newData;
}

public Instances resample ( Random random ) { Instances newData = new Instances ( this , numInstances ( ) ) ; while ( newData . numInstances ( ) < numInstances ( ) ) { newData . add ( instance ( random . nextInt ( numInstances ( ) ) ) ) ; } return newData ; }
creates a new dataset of the same size using random sampling with replacement .
