Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Write a Java application which tests the random number generation abilities o

ID: 3584114 • Letter: 2

Question

2. Write a Java application which tests the random number generation abilities of Java. Random number generation is explained below.Your application should simulate rolling a pair of dice some number of times. Use a JOptionPane to ask the user how many times the dice should be rolled. Each dice roll can be a value between 1 and 6, so rolling 2 dice will result in values between 2 and 12. You need to generate a random number between 1 and 6 to simulate rolling each dice. Keep track of the result of each roll using an array that is indexed by the sum of the roll of the two dice. Output your result in a table which shows each value (ie. 2

Explanation / Answer

(rate me first thanks)

Solution

import java.util.Random;
public class RandomTest {;

public static void main(String[] args) {
Random rand = new Random(20071969);

for (int j = 0; j<10; j++)
{
int pick = rand.nextInt(10);
System.out.println(pick);
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote