Interface StreamInterface

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getOriginalSeed()
      Return the original seed of the generator with which it has been first initialized.
      long getSeed()
      Return the seed of the generator.
      boolean nextBoolean()
      Return the next pseudo-random, uniformly distributed boolean value.
      double nextDouble()
      Return a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.
      float nextFloat()
      Return a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.
      int nextInt()
      Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.
      int nextInt​(int i, int j)
      Return pseudo-random number from the stream between the integers i (inclusive) and j (inclusive).
      long nextLong()
      Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.
      void reset()
      Reset the stream to use the original seed with which it was initialized.
      void restoreState​(byte[] state)
      Restore the state to an earlier saved state object.
      byte[] saveState()
      Save the state of the RNG into an object, e.g.
      void setSeed​(long seed)
      Set the seed of the generator.
    • Method Detail

      • nextBoolean

        boolean nextBoolean()
        Return the next pseudo-random, uniformly distributed boolean value.
        Returns:
        boolean; a pseudo-random boolean with 50/50 chance for true or false
      • nextDouble

        double nextDouble()
        Return a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.
        Returns:
        double; the pseudo-random number
      • nextFloat

        float nextFloat()
        Return a pseudo-random number from the stream over the interval (0,1) using this stream, after advancing its state by one step.
        Returns:
        float; the pseudo-random number
      • nextInt

        int nextInt()
        Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.
        Returns:
        int; the pseudo-random number
      • nextInt

        int nextInt​(int i,
                    int j)
        Return pseudo-random number from the stream between the integers i (inclusive) and j (inclusive).
        Parameters:
        i - int; the minimal value
        j - int; the maximum value
        Returns:
        int; a value between i and j
      • nextLong

        long nextLong()
        Return a pseudo-random number from the stream over using this stream, after advancing its state by one step.
        Returns:
        long; the pseudo-random number
      • getSeed

        long getSeed()
        Return the seed of the generator.
        Returns:
        long; the seed
      • getOriginalSeed

        long getOriginalSeed()
        Return the original seed of the generator with which it has been first initialized.
        Returns:
        long; the original seed of the generator when it was first initialized
      • setSeed

        void setSeed​(long seed)
        Set the seed of the generator.
        Parameters:
        seed - long; the new seed
      • reset

        void reset()
        Reset the stream to use the original seed with which it was initialized.
      • saveState

        byte[] saveState()
                  throws StreamException
        Save the state of the RNG into an object, e.g. to roll it back to this state.
        Returns:
        the state as an object specific to the RNG.
        Throws:
        StreamException - when getting the state fails.
      • restoreState

        void restoreState​(byte[] state)
                   throws StreamException
        Restore the state to an earlier saved state object.
        Parameters:
        state - Object; the earlier saved state to which the RNG rolls back.
        Throws:
        StreamException - when resetting the state fails.