You want to look at the
Java API docs for the
Math class.
For the random method, go to:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html#random()
The Math.random() functions returns a double. This is a floating point number between 0 and 1.0.
To get that range to be 0 to 6, we simply multiply the result of it by 6, then convert it to an integer (disposing of everything after the decimal point. Of course, this will give us a number
between 0 and 6, but it won't
include 6. To do this, we simply add 1 and bump any random number generated up by 1.