All Implemented Interfaces:
RandomLongGenerator, RandomNumberGenerator, Seedable

public class SHR3 extends Object implements RandomLongGenerator
SHR3 is a 3-shift-register generator with period 2^32-1. It uses y(n)=y(n-1)(I+L^17)(I+R^13)(I+L^5), with the y's viewed as binary vectors, L the 32x32 binary matrix that shifts a vector left 1, and R its transpose. SHR3 seems to pass all tests except those related to the binary rank test, since 32 successive values, as binary vectors, must be linearly independent, while 32 successive truly random 32-bit integers, viewed as binary vectors, will be linearly independent only about 29% of the time.
  • Constructor Details

    • SHR3

      public SHR3()
  • Method Details

    • seed

      public void seed(long... seeds)
      Description copied from interface: Seedable
      Seed the random number/vector/scenario generator to produce repeatable experiments.
      Specified by:
      seed in interface Seedable
      seeds - the seeds
    • nextLong

      public long nextLong()
      Description copied from interface: RandomLongGenerator
      Get the next random long.
      Specified by:
      nextLong in interface RandomLongGenerator
      the next random long
    • nextDouble

      public double nextDouble()
      Description copied from interface: RandomNumberGenerator
      Get the next random double.
      Specified by:
      nextDouble in interface RandomNumberGenerator
      the next random number
    • nextInt

      public int nextInt()