# 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:
  - vertx-auth-common-js/vertx_context_prng.js, line 36

### Methods

#### nextInt() → {number}

Returns a secure random int

Source:
  - vertx-auth-common-js/vertx_context_prng.js, line 63

##### 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:
  - vertx-auth-common-js/vertx_context_prng.js, line 49

##### Returns:

A base 64 encoded string.

Type
  string