Returns a new instance of
SecureRandom.
It tries to create an instance with the algorithm name specified in the
system property `uuidcreator.securerandom` or in the environment variable
`UUIDCREATOR_SECURERANDOM`. If the algorithm name is not supported by the
runtime, it returns an instance with the default algorithm.
It can be useful to make use of SHA1PRNG or DRBG as a non-blocking source of
random bytes. The SHA1PRNG algorithm is default in some operating systems
that don't have '/dev/random' or '/dev/urandom', e.g., in Windows. The DRBG
algorithm is available in JDK9+.
To control the algorithm used by this method, use the system property
`uuidcreator.securerandom` or the environment variable
`UUIDCREATOR_SECURERANDOM` as in examples below.
System property:
# Use the the algorithm SHA1PRNG for SecureRandom
-Duuidcreator.securerandom="SHA1PRNG"
# Use the the algorithm DRBG for SecureRandom (JDK9+)
-Duuidcreator.securerandom="DRBG"
Environment variable:
# Use the the algorithm SHA1PRNG for SecureRandom
export UUIDCREATOR_SECURERANDOM="SHA1PRNG"
# Use the the algorithm DRBG for SecureRandom (JDK9+)
export UUIDCREATOR_SECURERANDOM="DRBG"