io.vertx.ext.auth

## Interface VertxContextPRNG

- All Superinterfaces:
    VertxContextPRNG

  Deprecated.
  instead use `VertxContextPRNG`

      @Deprecated
      public interface VertxContextPRNG
      extends VertxContextPRNG

  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.

  Author:
    Paulo Lopes

- - ### Method Summary

    All Methods Static Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static VertxContextPRNG` | `current()` Deprecated. Get or create a secure non blocking random number generator using the current vert.x context.
    `static VertxContextPRNG` | `current(Context context)` Deprecated. Get or create a secure non blocking random number generator using the provided vert.x context.
    `static VertxContextPRNG` | `current(Vertx vertx)` Deprecated. Get or create a secure non blocking random number generator using the current vert.x instance.

    - ### Methods inherited from interface io.vertx.ext.auth.prng.VertxContextPRNG

      `close, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, nextString`

- - ### Method Detail

    - #### current

          static VertxContextPRNG current()

      Deprecated.
      Get or create a secure non blocking random number generator using the current vert.x context. If there is no current context (i.e.: not running on the eventloop) then a `IllegalStateException` is thrown. Note, if a context isn't allowed to be used, for example, exceptions are thrown on getting and putting data, the VertxContextPRNG falls back to instantiate a new instance of the PRNG per call.
      Specified by:
        `current` in interface `VertxContextPRNG`
      Returns:
        A secure non blocking random number generator.
      Throws:
        `IllegalStateException` - when there is no `Context` instance available.

    - #### current

          static VertxContextPRNG current(Context context)

      Deprecated.
      Get or create a secure non blocking random number generator using the provided vert.x context. This method will not throw an exception. Note, if a context isn't allowed to be used, for example, exceptions are thrown on getting and putting data, the VertxContextPRNG falls back to instantiate a new instance of the PRNG per call.
      Specified by:
        `current` in interface `VertxContextPRNG`
      Parameters:
        `context` - a Vert.x context.
      Returns:
        A secure non blocking random number generator
      Throws:
        `IllegalStateException` - when there is no `Vertx` instance available.

    - #### current

          static VertxContextPRNG current(Vertx vertx)

      Deprecated.
      Get or create a secure non blocking random number generator using the current vert.x instance. Since the context might be different this method will attempt to use the current context first if available and then fall back to create a new instance of the PRNG. Note, if a context isn't allowed to be used, for example, exceptions are thrown on getting and putting data, the VertxContextPRNG falls back to instantiate a new instance of the PRNG per call.
      Specified by:
        `current` in interface `VertxContextPRNG`
      Parameters:
        `vertx` - a Vert.x instance.
      Returns:
        A secure non blocking random number generator.

Copyright © 2025 Eclipse. All rights reserved.