Class RandomSupport
java.lang.Object
zeroecho.core.util.RandomSupport
Provides the authoritative process-wide cryptographic random source.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]generateRandom(byte[] buffer) Fills the supplied array with random bytes.static byte[]generateRandom(int size) Allocates and fills a random byte array.static SecureRandomReturns the shared thread-safe random source.static intnextInt(int bound) Returns a uniform value below the bound.
-
Method Details
-
getRandom
Returns the shared thread-safe random source.- Returns:
- shared secure random generator
-
generateRandom
public static byte[] generateRandom(int size) Allocates and fills a random byte array.- Parameters:
size- required array length- Returns:
- random bytes
-
generateRandom
public static byte[] generateRandom(byte[] buffer) Fills the supplied array with random bytes.- Parameters:
buffer- destination array- Returns:
buffer
-
nextInt
public static int nextInt(int bound) Returns a uniform value below the bound.- Parameters:
bound- exclusive positive upper bound- Returns:
- generated value
-