The SecureRandom
class
The SecureRandom
class in the JCECCA provider is a true random number
generator that does not need seeding. Therefore, calls to setSeed()
,
getSeed()
and generateSeed()
throw an exception.
The following example shows how to use the
SecureRandom
class:java.security.SecureRandom random = null;
random = java.security.SecureRandom.getInstance( "IBMSecureRandom");
byte[] testData = new byte[1024];
random.nextBytes(testData);
In this example, an instance of the
SecureRandom
class is obtained, a byte array is instantiated, and a random number
of size 1024 bytes is generated.See the Java™ API documentation for the specific methods, default values and restrictions that are associated with this class
For more information about configuring the caching version of the SecureRandom
implementation for the IBMJCECCA provider, see Random number generation.