Module com.github.f4b6a3.uuid
Package com.github.f4b6a3.uuid.factory
Class AbstRandomBasedFactory.SafeRandom
- java.lang.Object
-
- com.github.f4b6a3.uuid.factory.AbstRandomBasedFactory.SafeRandom
-
- All Implemented Interfaces:
AbstRandomBasedFactory.IRandom
- Enclosing class:
- AbstRandomBasedFactory
protected static final class AbstRandomBasedFactory.SafeRandom extends Object implements AbstRandomBasedFactory.IRandom
A byte random generator.
-
-
Constructor Summary
Constructors Constructor Description SafeRandom()Default constructor.SafeRandom(IntFunction<byte[]> randomFunction)Constructor with a function which returns random numbers.SafeRandom(Random random)Constructor with a random.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]nextBytes(int length)Return a random array of bytes.longnextLong()Return a random number.longnextLong(int length)Return a random number.
-
-
-
Constructor Detail
-
SafeRandom
public SafeRandom()
Default constructor.
-
SafeRandom
public SafeRandom(Random random)
Constructor with a random.- Parameters:
random- a random
-
SafeRandom
public SafeRandom(IntFunction<byte[]> randomFunction)
Constructor with a function which returns random numbers.- Parameters:
randomFunction- a function
-
-
Method Detail
-
nextLong
public long nextLong()
Description copied from interface:AbstRandomBasedFactory.IRandomReturn a random number.- Specified by:
nextLongin interfaceAbstRandomBasedFactory.IRandom- Returns:
- a number
-
nextLong
public long nextLong(int length)
Description copied from interface:AbstRandomBasedFactory.IRandomReturn a random number.- Specified by:
nextLongin interfaceAbstRandomBasedFactory.IRandom- Parameters:
length- the byte array length- Returns:
- a number
-
nextBytes
public byte[] nextBytes(int length)
Description copied from interface:AbstRandomBasedFactory.IRandomReturn a random array of bytes.- Specified by:
nextBytesin interfaceAbstRandomBasedFactory.IRandom- Parameters:
length- the byte array length- Returns:
- an array
-
-