Class: VertxContextPRNG

vertx-auth-common-js/vertx_context_prng~ VertxContextPRNG

new 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.

Source:

Methods

nextInt() → {number}

Returns a secure random int
Source:
Returns:
random int.
Type
number

nextString(length) → {string}

Returns a Base64 mime encoded String of random data with the given length. The length parameter refers to the length of the String before the encoding step.
Parameters:
Name Type Description
length number the desired string length before Base64 encoding.
Source:
Returns:
A base 64 encoded string.
Type
string