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.

package

Default

Methods

__construct

__construct() 

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 {@link java.lang.IllegalStateException} is thrown.

current( $arg0 = null) : \io\vertx\jphp\ext\auth\VertxContextPRNG
static

current()

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.

param $vertx [Vertx] a Vert.x instance. current($vertx)

Arguments

$arg0

Vertx

Response

\io\vertx\jphp\ext\auth\VertxContextPRNG

A secure non blocking random number generator.

Returns a secure random int

nextInt( $arg0 = null) : integer

nextInt()

Returns a secure random int, between 0 (inclusive) and the specified bound (exclusive).

param $bound [integer] the upper bound (exclusive), which must be positive. nextInt($bound)

Arguments

$arg0

integer

Response

integer

random int.

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.

nextString( $arg0) : string

Arguments

$arg0

integer

Response

string

A base 64 encoded string.