Class VertxContextPRNG

  • Direct Known Subclasses:
    VertxContextPRNG

    public class VertxContextPRNG
    extends Object
    A secure non blocking random number generator isolated to the current context. The PRNG is bound to the vert.x context and setup to close when the context shuts down.

    When applicable, use of VertxContextPRNG rather than create new PRNG objects is helpful to keep the system entropy usage to the minimum avoiding potential blocking across the application.

    The use of VertxContextPRNG is particularly appropriate when multiple handlers use random numbers.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • VertxContextPRNG

        public VertxContextPRNG​(io.vertx.ext.auth.prng.VertxContextPRNG delegate)
      • VertxContextPRNG

        public VertxContextPRNG​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.auth.prng.VertxContextPRNG getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • current

        public static VertxContextPRNG current()
        Returns:
        A secure non blocking random number generator.
      • current

        public static VertxContextPRNG current​(Vertx vertx)
        Parameters:
        vertx - a Vert.x instance.
        Returns:
        A secure non blocking random number generator.
      • close

        public void close()
      • nextString

        public String nextString​(int length)
        Parameters:
        length - the desired string length before Base64 encoding.
        Returns:
        A base 64 encoded string.
      • nextInt

        public int nextInt()
        Returns:
        random int.
      • nextInt

        public int nextInt​(int bound)
        Parameters:
        bound - the upper bound (exclusive), which must be positive.
        Returns:
        random int.
      • nextBoolean

        public boolean nextBoolean()
        Returns:
        random boolean.
      • nextLong

        public long nextLong()
        Returns:
        random long.
      • nextFloat

        public float nextFloat()
        Returns:
        random float.
      • nextDouble

        public double nextDouble()
        Returns:
        random double.
      • nextGaussian

        public double nextGaussian()
        Returns:
        random double.
      • nextBytes

        public void nextBytes​(byte[] bytes)
        Parameters:
        bytes - a byte array.
      • newInstance

        public static VertxContextPRNG newInstance​(io.vertx.ext.auth.prng.VertxContextPRNG arg)