public class VertxContextPRNG extends Object
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.
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<VertxContextPRNG> |
__TYPE_ARG |
Constructor and Description |
---|
VertxContextPRNG(Object delegate) |
VertxContextPRNG(VertxContextPRNG delegate) |
Modifier and Type | Method and Description |
---|---|
static VertxContextPRNG |
current()
Get or create a secure non blocking random number generator using the current vert.x context.
|
static VertxContextPRNG |
current(Vertx vertx)
Get or create a secure non blocking random number generator using the current vert.x instance.
|
boolean |
equals(Object o) |
VertxContextPRNG |
getDelegate() |
int |
hashCode() |
static VertxContextPRNG |
newInstance(VertxContextPRNG arg) |
int |
nextInt()
Returns a secure random int
|
int |
nextInt(int bound)
Returns a secure random int, between 0 (inclusive) and the specified bound (exclusive).
|
String |
nextString(int length)
Returns a Base64 mime encoded String of random data with the given length.
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<VertxContextPRNG> __TYPE_ARG
public VertxContextPRNG(VertxContextPRNG delegate)
public VertxContextPRNG(Object delegate)
public VertxContextPRNG getDelegate()
public static VertxContextPRNG current()
IllegalStateException
is thrown.public static VertxContextPRNG current(Vertx vertx)
vertx
- a Vert.x instance.public String nextString(int length)
length
- the desired string length before Base64 encoding.public int nextInt()
public int nextInt(int bound)
bound
- the upper bound (exclusive), which must be positive.public static VertxContextPRNG newInstance(VertxContextPRNG arg)
Copyright © 2023 Eclipse. All rights reserved.