public static int randomNumberBetween(double begin,double end){
  if (begin > end)   throw new IllegalArgumentException("Begin must not be less than end");
  return (int)begin + (int)(Math.random() * ((end - begin) + 1));
}

public static int randomNumberBetween ( double begin , double end ) { if ( begin > end ) throw new IllegalArgumentException ( "Begin must not be less than end" ) ; return ( int ) begin + ( int ) ( Math . random ( ) * ( ( end - begin ) + 1 ) ) ; }
generates a random integer between the specified numbers
