private static float[] randomPoints(Random random,int wavesCount,float width,float shiftCoef){
  float shift;
  float[] points=new float[wavesCount + 1];
  for (int i=0; i < points.length; i++) {
    if (i == 0) {
      points[i]=-1;
    }
 else     if (i == points.length - 1) {
      points[i]=1;
    }
 else {
      shift=random.nextFloat() * shiftCoef * width;
      shift*=random.nextBoolean() ? 1 : -1;
      points[i]=-1 + i * width + shift;
    }
  }
  return points;
}

private static float [ ] randomPoints ( Random random , int wavesCount , float width , float shiftCoef ) { float shift ; float [ ] points = new float [ wavesCount + 1 ] ; for ( int i = 0 ; i < points . length ; i ++ ) { if ( i == 0 ) { points [ i ] = - 1 ; } else if ( i == points . length - 1 ) { points [ i ] = 1 ; } else { shift = random . nextFloat ( ) * shiftCoef * width ; shift *= random . nextBoolean ( ) ? 1 : - 1 ; points [ i ] = - 1 + i * width + shift ; } } return points ; }
generate random points for wave .
