cs175:using_objects_lab
Using Objects Lab
Do Practice Exercise E2.11 (p. 75) in DrJava:
The Random
class implements a random number generator, which produces sequences of numbers that appear to be random. To generate random integers, you construct an object of the Random
class, and then apply the nextInt
method. For example, the call
generator.nextInt(6)
gives you (returns) a random integer between 0 and 5.
Write a program DieSimulator that uses the Random
class to simulate the cast of a die, printing a random number between 1 and 6 every time that the program is run.
cs175/using_objects_lab.txt · Last modified: 2014/09/25 00:05 by jchung