Question: Consider the following statement: int num = /* expression */; Which of the following replacements for /* expression */ creates in num a random integer
Consider the following statement:
int num = /* expression */;
Which of the following replacements for /* expression */ creates in num a random integer from 2 to 50, including 2 and 50?
a) (int)(Math.random() * 49) - 2
b) (int)(Math.random() * 50) - 2
c) (int)(Math.random() * 50) + 2
d) (int)(Math.random() * 49) + 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
