Class AbstractL64

    • Field Detail

      • la

        protected long la
        Per-instance LCG additive parameter (must be odd). Cannot be final to support RestorableUniformRandomProvider.
      • ls

        protected long ls
        State of the LCG generator.
    • Constructor Detail

      • AbstractL64

        AbstractL64​(long[] seed)
        Creates a new instance.
        Parameters:
        seed - Initial seed. If the length is larger than 2, only the first 2 elements will be used; if smaller, the remaining elements will be automatically set.

        The 1st element is used to set the LCG increment; the least significant bit is set to odd to ensure a full period LCG. The 2nd element is used to set the LCG state.

      • AbstractL64

        AbstractL64​(long seed0,
                    long seed1)
        Creates a new instance using a 2 element seed.

        The 1st element is used to set the LCG increment; the least significant bit is set to odd to ensure a full period LCG. The 2nd element is used to set the LCG state.

        Parameters:
        seed0 - Initial seed element 0.
        seed1 - Initial seed element 1.
      • AbstractL64

        AbstractL64​(AbstractL64 source)
        Creates a copy instance.
        Parameters:
        source - Source to copy.
    • Method Detail

      • setState

        private void setState​(long[] state)
        Copies the state into the generator state.
        Parameters:
        state - the new state
      • getStateInternal

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

        public UniformRandomProvider jump()
        Creates a copy of the UniformRandomProvider and then retreats the state of the current instance. The copy is returned.

        The jump is performed by advancing the state of the LCG sub-generator by 1 cycle. The XBG state is unchanged.

        Specified by:
        jump in interface JumpableUniformRandomProvider
        Returns:
        A copy of the current state.
      • longJump

        public JumpableUniformRandomProvider longJump()
        Creates a copy of the UniformRandomProvider and then retreats the state of the current instance. The copy is returned.

        The jump is performed by advancing the state of the LCG sub-generator by 232 cycles. The XBG state is unchanged.

        Specified by:
        longJump in interface LongJumpableUniformRandomProvider
        Returns:
        A copy of the current state.
      • copy

        abstract AbstractL64 copy()
        Create a copy.
        Returns:
        the copy