Class RandomSupport

java.lang.Object
zeroecho.core.util.RandomSupport

public final class RandomSupport extends Object
Provides the authoritative process-wide cryptographic random source.
  • Method Details

    • getRandom

      public static SecureRandom 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