module Concurrent::ThreadSafe::Util::XorShiftRandom

def get

Generates an initial non-zero positive +Fixnum+ via +Kernel.rand+.
def get
  Kernel.rand(MAX_XOR_SHIFTABLE_INT) + 1 # 0 can't be xorshifted
end

def xorshift(x)

using the "yˆ=y>>a; yˆ=y<>c;" transform with the (a,b,c) tuple with values (3,1,14) to minimise Bignum overflows
def xorshift(x)
  x ^= x >> 3
  x ^= (x << 1) & MAX_INT # cut-off Bignum overflow
  x ^= x >> 14
end

def xorshift(x)

using the "yˆ=y>>a; yˆ=y<>c;" transform with the (a,b,c) tuple with values (1,1,54) to minimise Bignum overflows
def xorshift(x)
  x ^= x >> 1
  x ^= (x << 1) & MAX_INT # cut-off Bignum overflow
  x ^= x >> 54
end