public static double logPdf(double x,double lower,double upper){
  if (x < lower || x > upper)   return Double.NEGATIVE_INFINITY;
  return -Math.log(upper - lower);
}

public static double logPdf ( double x , double lower , double upper ) { if ( x < lower || x > upper ) return Double . NEGATIVE_INFINITY ; return - Math . log ( upper - lower ) ; }
the natural log of the probability density function of the uniform distribution
