io.vertx.ext.auth

## Class PRNG

- java.lang.Object
- - io.vertx.ext.auth.PRNG

- All Implemented Interfaces:
    VertxContextPRNG

      public class PRNG
      extends Object
      implements VertxContextPRNG

  Wrapper around secure random that periodically seeds the PRNG with new entropy. To avoid entropy exhaustion the entropy is only refreshed if the PRNG is used. This introduces a new variable which reduces the probability of cracking the random number generator.
  Author:
    Paulo Lopes

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PRNG(Vertx vertx)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` stop seeding the PRNG
    `boolean` | `nextBoolean()` Returns a secure random boolean
    `void` | `nextBytes(byte[] bytes)` Fills the given byte array with random bytes.
    `double` | `nextDouble()` Returns a secure random double value.
    `float` | `nextFloat()` Returns a secure random float value.
    `double` | `nextGaussian()` Returns a secure random double value.
    `int` | `nextInt()` Returns a secure random int
    `int` | `nextInt(int bound)` Returns a secure random int, between 0 (inclusive) and the specified bound (exclusive).
    `long` | `nextLong()` Returns a secure random long
    `String` | `nextString(int length)` Returns a Base64 url encoded String of random data with the given length.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

      `current, current, current`

- - ### Constructor Detail

    - #### PRNG

          public PRNG(Vertx vertx)

  - ### Method Detail

    - #### close

          public void close()

      Description copied from interface: `VertxContextPRNG`
      stop seeding the PRNG
      Specified by:
        `close` in interface `VertxContextPRNG`

    - #### nextBytes

          public void nextBytes(byte[] bytes)

      Description copied from interface: `VertxContextPRNG`
      Fills the given byte array with random bytes.
      Specified by:
        `nextBytes` in interface `VertxContextPRNG`
      Parameters:
        `bytes` - a byte array.

    - #### nextInt

          public int nextInt()

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random int
      Specified by:
        `nextInt` in interface `VertxContextPRNG`
      Returns:
        random int.

    - #### nextInt

          public int nextInt(int bound)

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random int, between 0 (inclusive) and the specified bound (exclusive).
      Specified by:
        `nextInt` in interface `VertxContextPRNG`
      Parameters:
        `bound` - the upper bound (exclusive), which must be positive.
      Returns:
        random int.

    - #### nextBoolean

          public boolean nextBoolean()

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random boolean
      Specified by:
        `nextBoolean` in interface `VertxContextPRNG`
      Returns:
        random boolean.

    - #### nextLong

          public long nextLong()

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random long
      Specified by:
        `nextLong` in interface `VertxContextPRNG`
      Returns:
        random long.

    - #### nextFloat

          public float nextFloat()

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random float value. The value is uniformly distributed between 0.0 and 1.0
      Specified by:
        `nextFloat` in interface `VertxContextPRNG`
      Returns:
        random float.

    - #### nextDouble

          public double nextDouble()

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random double value. The value is uniformly distributed between 0.0 and 1.0
      Specified by:
        `nextDouble` in interface `VertxContextPRNG`
      Returns:
        random double.

    - #### nextGaussian

          public double nextGaussian()

      Description copied from interface: `VertxContextPRNG`
      Returns a secure random double value. The value is Gaussian ("normally") distributed with mean 0.0 and standard deviation 1.0
      Specified by:
        `nextGaussian` in interface `VertxContextPRNG`
      Returns:
        random double.

    - #### nextString

          public String nextString(int length)

      Description copied from interface: `VertxContextPRNG`
      Returns a Base64 url encoded String of random data with the given length. The length parameter refers to the length of the String before the encoding step.
      Specified by:
        `nextString` in interface `VertxContextPRNG`
      Parameters:
        `length` - the desired string length before Base64 encoding.
      Returns:
        A base 64 encoded string.

Copyright © 2022 Eclipse. All rights reserved.