A pair of number cubes is used in a game of chance. Each number cube has six sides, numbered from 1 to 6, inclusive, and there is an equal probability for each of the numbers to appear on the top side (indicating the cube's value) when the number cube is rolled. The following incomplete statement appears in a program that computes the sum of the values produced by rolling two number cubes.
int sum = / missing code / ;
Which of the following replacements for / missing code / would best simulate the value produced as a result of rolling two number cubes?
A 2 (int) (Math.random() 6)
B 2 (int) (Math.random() 7)
C (int) (Math.random() 6) + (int) (Math.random() 6)
D (int) (Math.random() * 13)
E 2 + (int) (Math.random() 6) + (int) (Math.random() 6)



Answer :

Other Questions