@Override public Instance generateExample() throws Exception {
  Instance result;
  Random rand;
  double x;
  double y;
  double[] atts;
  result=null;
  rand=getRandom();
  if (m_DatasetFormat == null) {
    throw new Exception("Dataset format not defined.");
  }
  atts=new double[m_DatasetFormat.numAttributes()];
  x=rand.nextDouble();
  x=x * (getMaxRange() - getMinRange()) + getMinRange();
  if (Utils.eq(x,0)) {
    y=getAmplitude();
  }
 else {
    y=getAmplitude() * StrictMath.sin(StrictMath.abs(x)) / StrictMath.abs(x);
  }
  y=y + getAmplitude() * m_NoiseRandom.nextGaussian() * getNoiseRate()* getNoiseVariance();
  atts[0]=x;
  atts[1]=y;
  result=new DenseInstance(1.0,atts);
  result.setDataset(m_DatasetFormat);
  return result;
}

@ Override public Instance generateExample ( ) throws Exception { Instance result ; Random rand ; double x ; double y ; double [ ] atts ; result = null ; rand = getRandom ( ) ; if ( m_DatasetFormat == null ) { throw new Exception ( "Dataset format not defined." ) ; } atts = new double [ m_DatasetFormat . numAttributes ( ) ] ; x = rand . nextDouble ( ) ; x = x * ( getMaxRange ( ) - getMinRange ( ) ) + getMinRange ( ) ; if ( Utils . eq ( x , 0 ) ) { y = getAmplitude ( ) ; } else { y = getAmplitude ( ) * StrictMath . sin ( StrictMath . abs ( x ) ) / StrictMath . abs ( x ) ; } y = y + getAmplitude ( ) * m_NoiseRandom . nextGaussian ( ) * getNoiseRate ( ) * getNoiseVariance ( ) ; atts [ 0 ] = x ; atts [ 1 ] = y ; result = new DenseInstance ( 1.0 , atts ) ; result . setDataset ( m_DatasetFormat ) ; return result ; }
generates one example of the dataset .
