Class IntProvider

    • Constructor Detail

      • IntProvider

        public IntProvider()
    • Method Detail

      • getStateInternal

        protected byte[] getStateInternal()
        Creates a snapshot of the RNG state.
        Overrides:
        getStateInternal in class BaseProvider
        Returns:
        the internal state.
      • nextInt

        public int nextInt()
        Generates an int value.
        Specified by:
        nextInt in interface UniformRandomProvider
        Returns:
        the next random value.
      • nextBoolean

        public boolean nextBoolean()
        Generates a boolean value.
        Specified by:
        nextBoolean in interface UniformRandomProvider
        Returns:
        the next random value.
      • nextDouble

        public double nextDouble()
        Generates a double value between 0 and 1.
        Specified by:
        nextDouble in interface UniformRandomProvider
        Returns:
        the next random value between 0 and 1.
      • nextFloat

        public float nextFloat()
        Generates a float value between 0 and 1.
        Specified by:
        nextFloat in interface UniformRandomProvider
        Returns:
        the next random value between 0 and 1.
      • nextLong

        public long nextLong()
        Generates a long value.
        Specified by:
        nextLong in interface UniformRandomProvider
        Returns:
        the next random value.
      • nextBytes

        public void nextBytes​(byte[] bytes)
        Generates byte values and places them into a user-supplied array.

        The number of random bytes produced is equal to the length of the the byte array.

        Specified by:
        nextBytes in interface UniformRandomProvider
        Parameters:
        bytes - Byte array in which to put the random bytes. Cannot be null.
      • nextBytes

        public void nextBytes​(byte[] bytes,
                              int start,
                              int len)
        Generates byte values and places them into a user-supplied array.

        The array is filled with bytes extracted from random integers. This implies that the number of random bytes generated may be larger than the length of the byte array.

        Specified by:
        nextBytes in interface UniformRandomProvider
        Parameters:
        bytes - Array in which to put the generated bytes. Cannot be null.
        start - Index at which to start inserting the generated bytes.
        len - Number of bytes to insert.