Package io.vertx.mutiny.ext.auth.prng
Class VertxContextPRNG
- java.lang.Object
-
- io.vertx.mutiny.ext.auth.prng.VertxContextPRNG
-
- Direct Known Subclasses:
VertxContextPRNG
public class VertxContextPRNG extends Object
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.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<VertxContextPRNG>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description VertxContextPRNG(io.vertx.ext.auth.prng.VertxContextPRNG delegate)
VertxContextPRNG(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static VertxContextPRNG
current()
static VertxContextPRNG
current(Vertx vertx)
boolean
equals(Object o)
io.vertx.ext.auth.prng.VertxContextPRNG
getDelegate()
int
hashCode()
static VertxContextPRNG
newInstance(io.vertx.ext.auth.prng.VertxContextPRNG arg)
boolean
nextBoolean()
void
nextBytes(byte[] bytes)
double
nextDouble()
float
nextFloat()
double
nextGaussian()
int
nextInt()
int
nextInt(int bound)
long
nextLong()
String
nextString(int length)
String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<VertxContextPRNG> __TYPE_ARG
-
-
Constructor Detail
-
VertxContextPRNG
public VertxContextPRNG(io.vertx.ext.auth.prng.VertxContextPRNG delegate)
-
VertxContextPRNG
public VertxContextPRNG(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.auth.prng.VertxContextPRNG getDelegate()
-
current
public static VertxContextPRNG current()
- Returns:
- A secure non blocking random number generator.
-
current
public static VertxContextPRNG current(Vertx vertx)
- Parameters:
vertx
- a Vert.x instance.- Returns:
- A secure non blocking random number generator.
-
close
public void close()
-
nextString
public String nextString(int length)
- Parameters:
length
- the desired string length before Base64 encoding.- Returns:
- A base 64 encoded string.
-
nextInt
public int nextInt()
- Returns:
- random int.
-
nextInt
public int nextInt(int bound)
- Parameters:
bound
- the upper bound (exclusive), which must be positive.- Returns:
- random int.
-
nextBoolean
public boolean nextBoolean()
- Returns:
- random boolean.
-
nextLong
public long nextLong()
- Returns:
- random long.
-
nextFloat
public float nextFloat()
- Returns:
- random float.
-
nextDouble
public double nextDouble()
- Returns:
- random double.
-
nextGaussian
public double nextGaussian()
- Returns:
- random double.
-
nextBytes
public void nextBytes(byte[] bytes)
- Parameters:
bytes
- a byte array.
-
newInstance
public static VertxContextPRNG newInstance(io.vertx.ext.auth.prng.VertxContextPRNG arg)
-
-