public static double sample(Random rd,double min,double max){
  if (min >= max) {
    throw new IllegalArgumentException("Maximum must be greater than the minimum.");
  }
  return (rd.nextDouble() * (max - min)) + min;
}

public static double sample ( Random rd , double min , double max ) { if ( min >= max ) { throw new IllegalArgumentException ( "Maximum must be greater than the minimum." ) ; } return ( rd . nextDouble ( ) * ( max - min ) ) + min ; }
generates a new pseudo random number based on the generator and values provided as parameters .
