6.9 Case Study: Secure Random-Number Generation

We now take a brief diversion into a popular type of programming application—simulation and game playing. In this and the next section, we develop a game-playing program with multiple methods. The program uses most of the control statements presented thus far in the book and introduces several new programming concepts.

The element of chance can be introduced in a program via an object of class SecureRandom (package java.security). Such objects can produce random boolean, byte, float, double, int, long and Gaussian values. In the next several examples, we use objects of class SecureRandom to produce random values.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.