, (LFSR).
Wikipedia.
:
The initial value of the LFSR is called the seed, and because the operation
of the register is deterministic, the stream of values produced by the
register is completely determined by its current (or previous) state.
Likewise, because the register has a finite number of possible states, it must
eventually enter a repeating cycle. However, an LFSR with a well-chosen
feedback function can produce a sequence of bits which appears random and
which has a very long cycle.
, LFSR 2 N -1.
, , P N, "" 2 N -1, 2 (N-1) - 1 ( , , N-1).
, k (k = ((2 N -1) - P) ⋳ {1..., 2 (N-1) - 1}), ,
If (Mod(cur,2(N-1)+1-k) == 0) Then
cur=Mod(cur+1,2N-1)