Class LongProvider

    • Field Detail

      • EMPTY_BOOL_SOURCE

        private static final long EMPTY_BOOL_SOURCE
        Empty boolean source. This is the location of the sign-bit after 63 right shifts on the boolean source.
        See Also:
        Constant Field Values
      • EMPTY_INT_SOURCE

        private static final long EMPTY_INT_SOURCE
        Empty int source. This requires a negative value as the sign-bit is used to trigger a refill.
        See Also:
        Constant Field Values
      • booleanSource

        private long booleanSource
        Provides a bit source for booleans.

        A cached value from a call to RandomLongSource.next().

        Only stores 63-bits when full as 1 bit has already been consumed. The sign bit is a flag that shifts down so the source eventually equals 1 when all bits are consumed and will trigger a refill.

      • intSource

        private long intSource
        Provides a source for ints.

        A cached half-value value from a call to RandomLongSource.next(). The int is stored in the lower 32 bits with zeros in the upper bits. When empty this is set to negative to trigger a refill.

    • Constructor Detail

      • LongProvider

        public LongProvider()
        Creates a new instance.
      • LongProvider

        protected LongProvider​(LongProvider source)
        Creates a new instance copying the state from the source.

        This provides base functionality to allow a generator to create a copy, for example for use in the JumpableUniformRandomProvider interface.

        Parameters:
        source - Source to copy.
        Since:
        1.3