I want to generate a number between 1 and 10 in Java.
Here is what I tried:
Random rn = new Random();
int answer = rn.nextInt(10) + 1;
Is there a way to tell what to put in the parenthesis ()
when calling the nextInt method and what to add?
I want to generate a number between 1 and 10 in Java.
Here is what I tried:
Random rn = new Random();
int answer = rn.nextInt(10) + 1;
Is there a way to tell what to put in the parenthesis ()
when calling the nextInt method and what to add?