|
Java provides a random number generation class java.util.Random. There are two Random constructors. The first takes as input nothing and the second takes as input a seed value. The easiest way to generate random numbers is with the nextInt method. It takes as input an int and generates a number between 0 (inclusive) and the specified number (exclusive). An example follows:
|