Class MultiplyWithCarry256

    • Field Detail

      • state

        private final int[] state
        State.
      • index

        private int index
        Current index in "state" array.
      • carry

        private int carry
        Carry.
    • Constructor Detail

      • MultiplyWithCarry256

        public MultiplyWithCarry256​(int[] seed)
        Creates a new instance.
        Parameters:
        seed - Seed. If the length is larger than 257, only the first 257 elements will be used; if smaller, the remaining elements will be automatically set.
    • Method Detail

      • getStateInternal

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

        private void setSeedInternal​(int[] seed)
        Seeds the RNG.
        Parameters:
        seed - Seed.
      • next

        public int next()
        Return the next random value.
        Returns:
        the next random value.