Package 

Interface Random

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public class Random.RandomChecker
    • Method Summary

      Modifier and Type Method Description
      abstract long randomBytesRandom() Return a unsigned int byte 0 and 0xffffffff included.
      abstract long randomBytesUniform(int upperBound) Returns an unpredictable value between 0 and upperBound (excluded).Unlike randombytes_random() % upper_bound, it guarantees a uniform distributionof the possible output values even when upper_bound is not a power of 2.
      abstract void randomBytesBuf(Array<byte> buff, int size) Fill a buffer with random bytes.
      abstract Array<byte> randomBytesBuf(int size) Get a random number of bytes.
      abstract void randomBytesDeterministic(Array<byte> buff, int size, Array<byte> seed) Fill a buffer with deterministically random bytes given a seed.
      abstract Array<byte> randomBytesDeterministic(int size, Array<byte> seed) Get deterministically random bytes given a seed.
      abstract Array<byte> nonce(int size) Get a random number of bytes to use in a nonce.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • randomBytesRandom

         abstract long randomBytesRandom()

        Return a unsigned int byte 0 and 0xffffffff included.

      • randomBytesUniform

         abstract long randomBytesUniform(int upperBound)

        Returns an unpredictable value between 0 and upperBound (excluded).Unlike randombytes_random() % upper_bound, it guarantees a uniform distributionof the possible output values even when upper_bound is not a power of 2. Notethat an upper_bound less than 2 leaves only a single element to be chosen, namely 0.

        Parameters:
        upperBound - Upper bound (exclusive)
      • randomBytesBuf

         abstract void randomBytesBuf(Array<byte> buff, int size)

        Fill a buffer with random bytes.

        Parameters:
        buff - Buffer to fill.
        size - The number of bytes in the array to fill with random bytes.
      • randomBytesBuf

         abstract Array<byte> randomBytesBuf(int size)

        Get a random number of bytes.

        Parameters:
        size - The length of the byte array to return.
      • randomBytesDeterministic

         abstract void randomBytesDeterministic(Array<byte> buff, int size, Array<byte> seed)

        Fill a buffer with deterministically random bytes given a seed.

        Parameters:
        buff - Buffer to fill
        size - The number of bytes in the array to fill with random bytes.
        seed - Seed to provide.
      • randomBytesDeterministic

         abstract Array<byte> randomBytesDeterministic(int size, Array<byte> seed)

        Get deterministically random bytes given a seed.

        Parameters:
        size - Size of byte array to return.
        seed - Seed to provide.
      • nonce

         abstract Array<byte> nonce(int size)

        Get a random number of bytes to use in a nonce.

        Parameters:
        size - The size of the byte array to return.