@Override public double[] sample(){
  double sampled=sampler.nextFloat();
  double sum=0.0;
  for (  double[] point : points.keySet()) {
    sum+=points.get(point);
    if (sampled < sum) {
      return point;
    }
  }
  log.warning("discrete density function could not be sampled");
  return new double[0];
}

@ Override public double [ ] sample ( ) { double sampled = sampler . nextFloat ( ) ; double sum = 0.0 ; for ( double [ ] point : points . keySet ( ) ) { sum += points . get ( point ) ; if ( sampled < sum ) { return point ; } } log . warning ( "discrete density function could not be sampled" ) ; return new double [ 0 ] ; }
samples according to the density function
