lib/deacon/random_generator.rb
def next_lfsr25(seed)
      i = 1
      i = (seed + 1) & MASK
      raise ArgumentError, "Seed #{seed} out of bounds" if seed && i == 0
      i = (seed + 1) & MASK while i == 0
      i = (i >> 1) | ((i[0]^i[1]^i[2]^i[3]) << 0x18)
      i = (i >> 1) | ((i[0]^i[1]^i[2]^i[3]) << 0x18) while i > MASK
      i - 1
    end
def next_lfsr25(seed)
      i = 1
      i = (seed + 1) & MASK
      raise ArgumentError, "Seed #{seed} out of bounds" if seed && i == 0
      i = (seed + 1) & MASK while i == 0
      i = (i >> 1) | ((i[0]^i[1]^i[2]^i[3]) << 0x18)
      i = (i >> 1) | ((i[0]^i[1]^i[2]^i[3]) << 0x18) while i > MASK
      i - 1
    end
def next_lfsr25 ( seed ) i = 1 i = ( seed + 1 ) & MASK raise ArgumentError , "Seed #{seed} out of bounds" if seed && i == 0 i = ( seed + 1 ) & MASK while i == 0 i = ( i >> 1 ) | ( ( i [ 0 ] ^ i [ 1 ] ^ i [ 2 ] ^ i [ 3 ] ) << 0x18 ) i = ( i >> 1 ) | ( ( i [ 0 ] ^ i [ 1 ] ^ i [ 2 ] ^ i [ 3 ] ) << 0x18 ) while i > MASK i - 1 end
Fibonacci linear feedback shift register with x^25 + x^24 + x^23 + x^22 + 1 poly
Fibonacci linear feedback shift register with x^25 + x^24 + x^23 + x^22 + 1 poly