Class DotyHumphreySmallFastCounting32

  • All Implemented Interfaces:
    RandomIntSource, RestorableUniformRandomProvider, UniformRandomProvider

    public class DotyHumphreySmallFastCounting32
    extends IntProvider
    Implement the Small, Fast, Counting (SFC) 32-bit generator of Chris Doty-Humphrey. The original source is the PractRand test suite by the same author.

    The state size is 128-bits; the period is a minimum of 232 and an average of approximately 2127.

    Since:
    1.3
    See Also:
    PractRand
    • Field Detail

      • a

        private int a
        State a.
      • b

        private int b
        State b.
      • c

        private int c
        State c.
      • counter

        private int counter
        Counter.
    • Constructor Detail

      • DotyHumphreySmallFastCounting32

        public DotyHumphreySmallFastCounting32​(int[] seed)
        Creates an instance with the given seed.
        Parameters:
        seed - Initial seed. If the length is larger than 3, only the first 3 elements will be used; if smaller, the remaining elements will be automatically set.
    • Method Detail

      • setSeedInternal

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

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

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