Class JenkinsSmallFast32

All Implemented Interfaces:
RandomIntSource, RestorableUniformRandomProvider, UniformRandomProvider

public class JenkinsSmallFast32 extends IntProvider
Implement Bob Jenkins's small fast (JSF) 32-bit generator.

The state size is 128-bits; the shortest period is expected to be about 294 and it expected that about one seed will run into another seed within 264 values.

Since:
1.3
See Also:
  • Field Details

    • a

      private int a
      State a.
    • b

      private int b
      State b.
    • c

      private int c
      State c.
    • d

      private int d
      Statd d.
  • Constructor Details

    • JenkinsSmallFast32

      public JenkinsSmallFast32(Integer seed)
      Creates an instance with the given seed.
      Parameters:
      seed - Initial seed.
  • Method Details

    • setSeedInternal

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

      public final int next()
      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.
    • setStateInternal

      protected void setStateInternal(byte[] s)
      Resets the RNG to the given state.
      Overrides:
      setStateInternal in class IntProvider
      Parameters:
      s - State (previously obtained by a call to BaseProvider.getStateInternal()).
      See Also: