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 |
---|
__construct()
current( $arg0 = null) : \io\vertx\jphp\ext\auth\VertxContextPRNG
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)
Vertx
\io\vertx\jphp\ext\auth\VertxContextPRNG
A secure non blocking random number generator.
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)
integer
integer
random int.
nextString( $arg0) : string
integer
string
A base 64 encoded string.