Consider the following code segment.
int r = (int) (10 * Math.random()) + 1;
if (r == 1)

System.out.println("bullseye");

If you run this code segment multiple times, What do you expect to happen?
1) The code will always print "bullseye".
2) The code will never print "bullseye".
3) The code will print "bullseye" with a probability of 1/10.
4) The code will print "bullseye" with a probability of 1/11.

Q&A Education