Class AbstractRVariable

    • Field Detail

      • myRNStream

        protected RNStreamIfc myRNStream
        myRNStream provides a reference to the underlying stream of random numbers
    • Constructor Detail

      • AbstractRVariable

        public AbstractRVariable​(RNStreamIfc stream)
        Parameters:
        stream - the source of the randomness
        Throws:
        java.lang.NullPointerException - if rng is null
    • Method Detail

      • newInstance

        public final RVariableIfc newInstance​(boolean newRNG)
        Makes a new instance. False allows the new instance to keep using the same underlying source of random numbers.
        Parameters:
        newRNG - true means use new stream. This is same as newInstance(). False means clone uses same underlying source of randomness
        Returns:
        a new instance configured based on current instance
      • generate

        protected abstract double generate()
        Returns:
        the randomly generated variate
      • setPreviousValue

        protected final void setPreviousValue​(double value)
        Sets the last (previous) randomly generated value. Used within sample()
        Parameters:
        value - the value to assign
      • sample

        public final double sample()
        Specified by:
        sample in interface SampleIfc
        Returns:
        generates a random value
      • getValue

        public final double getValue()
        Description copied from interface: GetValueIfc
        This method simply returns the value.
        Specified by:
        getValue in interface GetValueIfc
        Specified by:
        getValue in interface RVariableIfc
        Returns:
        returns a sampled values
      • getPreviousValue

        public final double getPreviousValue()
        Description copied from interface: PreviousValueIfc
        Gets the previous number from the sequence of values
        Specified by:
        getPreviousValue in interface PreviousValueIfc
        Returns:
        a double representing the last value in the sequence
      • 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.
      • resetStartStream

        public final void resetStartStream()
        Description copied from interface: RNStreamControlIfc
        The resetStartStream method will position the RNG at the beginning of its stream. This is the same location in the stream as assigned when the RNG was created and initialized.
        Specified by:
        resetStartStream in interface RNStreamControlIfc
      • setAntitheticOption

        public final void setAntitheticOption​(boolean flag)
        Description copied from interface: RNStreamControlIfc
        Tells the stream to start producing antithetic variates
        Specified by:
        setAntitheticOption in interface RNStreamControlIfc
        Parameters:
        flag - true means that it produces antithetic variates.