I am attempting to write a program that pick s a random value that the user inputs and I am getting the error - possible lossy conversion from double to int. Here is my code. Any help is appreciated.
public class Driver
{
public static void main(String [] args)throws IOException{
int random;
int options;
Scanner input = new Scanner(System.in);
int randy;
System.out.print("Please enter the number of options you would like to use: ");
String [] choices = new String [input.nextInt()];
int min = 1;
int max = choices.length;
random = (Math.random() * ((max - min) + 1)) + min;
for(int i = 0; i < choices.length; i++){
System.out.print("Enter option " + (i+1) + ": ");
choices[i] = input.next();
}
System.out.print("The random option chosen is: " + choices[random]);
}
}