The Class Random
Explore how to generate pseudorandom numbers in Java using the class Random. Understand the role of seeds, methods to obtain random integers and doubles, and how these numbers are vital for applications such as games and simulations.
We'll cover the following...
Pseudorandom numbers
Applications such as games, lotteries, and simulations depend upon numbers that are chosen at random. Since computers are programmed, we cannot expect them to produce truly random numbers. Instead, we can create a sequence of numbers that does not repeat itself for a very long time. The numbers within any portion of this long sequence will appear to be random. Such numbers are called pseudorandom numbers, but we simply will call them random numbers. We use a random number generator to produce these numbers.
Seed
To begin a sequence of random numbers, we take a number called the ...