Class SecureRandomFactory


  • public final class SecureRandomFactory
    extends Object
    Factory for creating instances of SecureRandom. This class attempts to use a preferred algorithm to maximize security and performance.

    The factory prioritizes a list of preferred algorithms and falls back to the default algorithm if none of the preferred ones are available. The preferred algorithm is determined during class initialization.

    Since:
    09.04.25
    • Method Detail

      • getInstance

        public static SecureRandom getInstance()
        Returns an instance of SecureRandom. If a preferred algorithm is available, it will be used; otherwise, the default algorithm will be returned.
        Returns:
        A SecureRandom instance.
        Throws:
        IllegalStateException - If the preferred algorithm is unexpectedly unavailable.