Introduction to Java using NetBeans

Section 4 : Random Numbers


Generating Random Numbers

Games, simulators, screen savers, and many other types of applications make use of random numbers.

Dice are a common element in many games. In this activity, you will use random numbers to create a program that simulates the roll of a pair of dice.



Tutorial 5.1 - The random() Method and Rolling Dice



import java.lang.Math;




Use the information above to create "A Rolling Dice Program:

Create the following form:



Create a form
Create 2 integer Variables intDie1 and intDie2
Randomly generate the values
Display them in the appropriate text box





Assignment 4.1 Random Numbers

Create a form that prompts the user to enter the minimum and maximum values for their random numbers. The program should then calculate the random number and display it in the form.

For this assignment post the following:

1. Embed the Project Folder
2. Embed the Jar File
3. The code for the JFrame Form
4. Screen shot of the output
5. Code
(Use to keep the code in the proper format)

No Rubric for this Assignment it will be evaluated with the next Section