Generates a random integer based on min and max