Class RNStreamFactoryDepracated.RNStream

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void advanceState​(int e, int c)
      Advances the state by n steps (see below for the meaning of n), without modifying the states of the other streams or the values of Bg and Ig in the current object.
      void advanceToNextSubstream()
      Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.
      boolean getAntitheticOption()
      Returns whether or not the antithetic option is on (true) or off (false)
      double getAntitheticValue()
      Returns the antithetic of the previous U(0,1) i.e.
      int getId()  
      java.lang.String getName()  
      double getPrevU01()
      The previous U(0,1) generated (returned) by randU01()
      long[] getStartStreamSeed()
      Returns the seed for the start of the stream
      long[] getStartSubStreamSeed()
      Returns the seed for the start of the substream
      long[] getState()
      Returns the current state of this stream.
      void increasedPrecis​(boolean incp)
      If incp = true, each RNG call with this stream will now give 53 bits of resolution instead of 32 bits (assuming that the machine follows the IEEE-754 floating-point standard), and will advance the state of the stream by 2 steps instead of 1.
      RNStreamFactoryDepracated.RNStream newAntitheticInstance()  
      RNStreamFactoryDepracated.RNStream newAntitheticInstance​(java.lang.String name)  
      RNStreamFactoryDepracated.RNStream newInstance()
      Returns a copy of the stream with exactly the same state
      RNStreamFactoryDepracated.RNStream newInstance​(java.lang.String name)
      Returns a copy of the stream that has exactly the same state
      void printState()
      Prints the current state of this stream.
      void printStateFull()
      Writes to the standard output the value of all internal variables of this stream: name, anti, Ig, Bg, Cg
      int randInt​(int i, int j)
      Returns a (pseudo)random number from the discrete uniform distribution over the integers {i, i + 1, .
      double randU01()
      Returns a U(0, 1) (pseudo)random number, using this stream, after advancing its state by one step.
      void resetStartStream()
      Reinitializes the stream to its initial state: Cg and Bg are set to Ig.
      void resetStartSubstream()
      Reinitializes the stream to the beginning of its current substream: Cg is set to Bg.
      void setAntitheticOption​(boolean a)
      If a = true, the stream will now generate antithetic variates.
      void setName​(java.lang.String str)
      Sets the name
      boolean setSeed​(long[] seed)
      Sets the initial seed Ig of the stream to the vector seed.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface GetNameIfc
        Returns:
        a string representing the name of the object
      • getId

        public final int getId()
        Specified by:
        getId in interface IdentityIfc
        Returns:
        an int representing the id of the object
      • setName

        public final void setName​(java.lang.String str)
        Sets the name
        Parameters:
        str - The name as a string.
      • getStartStreamSeed

        public final long[] getStartStreamSeed()
        Returns the seed for the start of the stream
        Returns:
        the seed for the start of the stream
      • resetStartStream

        public final void resetStartStream()
        Reinitializes the stream to its initial state: Cg and Bg are set to Ig.
        Specified by:
        resetStartStream in interface RNStreamControlIfc
      • getStartSubStreamSeed

        public final long[] getStartSubStreamSeed()
        Returns the seed for the start of the substream
        Returns:
        the seed for the start of the substream
      • resetStartSubstream

        public final void resetStartSubstream()
        Reinitializes the stream to the beginning of its current substream: Cg is set to Bg.
        Specified by:
        resetStartSubstream in interface RNStreamControlIfc
      • advanceToNextSubstream

        public final void advanceToNextSubstream()
        Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng.
        Specified by:
        advanceToNextSubstream in interface RNStreamControlIfc
      • setAntitheticOption

        public final void setAntitheticOption​(boolean a)
        If a = true, the stream will now generate antithetic variates.
        Specified by:
        setAntitheticOption in interface RNStreamControlIfc
        Parameters:
        a - flag to turn on antithetic variates
      • getAntitheticOption

        public final boolean getAntitheticOption()
        Returns whether or not the antithetic option is on (true) or off (false)
        Specified by:
        getAntitheticOption in interface RNStreamControlIfc
        Returns:
        whether or not the antithetic option is on (true) or off (false)
      • increasedPrecis

        public final void increasedPrecis​(boolean incp)
        If incp = true, each RNG call with this stream will now give 53 bits of resolution instead of 32 bits (assuming that the machine follows the IEEE-754 floating-point standard), and will advance the state of the stream by 2 steps instead of 1.
        Parameters:
        incp - If incp = true, each RNG call with this stream will now give 53 bits of resolution instead of 32 bits
      • advanceState

        public final void advanceState​(int e,
                                       int c)
        Advances the state by n steps (see below for the meaning of n), without modifying the states of the other streams or the values of Bg and Ig in the current object. If e >0, then n = 2^e +c; if e < 0, then n = -2^-e + c; and if e = 0, then n = c. Note, c is allowed to take negative values
        Parameters:
        e - an integer
        c - an integer
      • setSeed

        public final boolean setSeed​(long[] seed)
        Sets the initial seed Ig of the stream to the vector seed. The vector seed should contain valid seed values. The state of the stream is then reset to this initial seed. The states and seeds of the other streams are not modified. As a result, after calling this procedure, the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of this procedure; proper use of Reset is preferable.
        Parameters:
        seed - the array of seeds
        Returns:
        returns true if the seed is valid
      • getState

        public final long[] getState()
        Returns the current state of this stream.
        Returns:
        An array representing the state
      • printState

        public final void printState()
        Prints the current state of this stream.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • printStateFull

        public final void printStateFull()
        Writes to the standard output the value of all internal variables of this stream: name, anti, Ig, Bg, Cg
      • randU01

        public final double randU01()
        Returns a U(0, 1) (pseudo)random number, using this stream, after advancing its state by one step. Exactly 0.0 or exactly 1.0 will not be generated
        Specified by:
        randU01 in interface RandU01Ifc
        Returns:
        the uniform (0,1) pseudo random number
      • getPrevU01

        public final double getPrevU01()
        The previous U(0,1) generated (returned) by randU01()
        Specified by:
        getPrevU01 in interface RandU01Ifc
        Returns:
        previous U(0,1) generated (returned) by randU01()
      • getAntitheticValue

        public final double getAntitheticValue()
        Returns the antithetic of the previous U(0,1) i.e. 1.0 - getPrevU01()
        Specified by:
        getAntitheticValue in interface GetAntitheticValueIfc
        Returns:
        the antithetic of the previous U(0,1) i.e. 1.0 - getPrevU01()
      • randInt

        public final int randInt​(int i,
                                 int j)
        Returns a (pseudo)random number from the discrete uniform distribution over the integers {i, i + 1, . . . , j }, using this stream. Calls randU01 once.
        Specified by:
        randInt in interface RNStreamIfc
        Parameters:
        i - start of range
        j - end of range
        Returns:
        The integer pseudo random number