Class: LFSR::Pure::Size4

Inherits:
Base
  • Object
show all
Defined in:
lib/lfsr/pure.rb

Constant Summary collapse

MASK =
0xf

Instance Attribute Summary

Attributes inherited from Base

#max, #reg, #seed

Instance Method Summary collapse

Methods inherited from Base

#initialize, #reset

Constructor Details

This class inherits a constructor from LFSR::Base

Instance Method Details

#next_iObject



31
32
33
34
35
# File 'lib/lfsr/pure.rb', line 31

def next_i
  @reg = (@reg >> 1) | ((@reg[0]^@reg[1]) << 0x3)
  @reg = (@reg >> 1) | ((@reg[0]^@reg[1]) << 0x3) while @reg > @max
  @reg - 1
end