Solved

Which of the Following Is the Correct Code Snippet for Throwing

Question 123

Multiple Choice

Which of the following is the correct code snippet for throwing a pair of dice to get a sum of the numbers on two dice between 2 and 12 with different probabilities? (Assume Random generator = new Random() ;)


A) int sum = generator.nextInt(6) + generator.nextInt(6) + 2
B) int sum = generator.nextInt(12) + 1
C) int sum = generator.nextInt(6 + 1) + generator.nextInt(6 + 1)
D) int sum = generator.nextInt(11) + 2

Correct Answer:

verifed

Verified

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents