comnum.prbs#

comnum.prbs(order, length, *, seed=1)#

A maximal-length pseudo-random binary sequence (ITU-T O.150 polynomials).

Parameters:
  • order (int) – 7, 9, 11, 15, 20, 23, 29 or 31 (period 2^order - 1); the polynomials of ITU-T O.150 at another phase, never inverted: see o150_sequence() for the sequences of the Recommendation.

  • length (int) – number of bits.

  • seed (int) – initial register state (non-zero after masking).

Returns:

length bits (uint8).

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter (the message names it).

Examples

>>> import comnum
>>> int(comnum.prbs(7, 127).sum())
64