Solved

Assume the Following Variable Has Been Declared and Given a Value

Question 22

Multiple Choice

Assume the following variable has been declared and given a value as shown: Random rand = new Random() ;
Which of the following will generate a random integer in the range - 20 to 20, inclusive, where each value has an equal chance of being generated?


A) rand.nextInt (-20, 20)
B) rand.nextInt(20) - 41
C) rand.nextInt (-20) + 40
D) rand.nextInt(41) - 20

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions