public static SecureRandom getInstance (String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException

Returns a SecureRandom object that implements the specified Random Number Generator (RNG) algorithm.

A new SecureRandom object encapsulating the SecureRandomSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

The returned SecureRandom object has not been seeded. To seed the returned object, call the setSeed method. If setSeed is not called, the first call to nextBytes will force the SecureRandom object to seed itself. This self-seeding will not occur if setSeed was previously called.

Parameters:
algorithm    the name of the RNG algorithm. See the SecureRandom section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard RNG algorithm names.
provider    the name of the provider.

Returns:  the new SecureRandom object.

Exceptions:
NoSuchAlgorithmException    if a SecureRandomSpi implementation for the specified algorithm is not available from the specified provider.
NoSuchProviderException    if the specified provider is not registered in the security provider list.
IllegalArgumentException    if the provider name is null or empty.

See also:
Provider

Since:  1.2