A Note About Performance

Using SecureRandom instead of Random to achieve higher levels of security incurs a significant performance penalty. For “casual” applications, you might want to use class Random from package java.util—simply replace SecureRandom with Random.

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.