generateSequence static method

Uint8List generateSequence()

Two random bytes followed by a 4-digit BCD counter that wraps at 9999.

Implementation

static Uint8List generateSequence() {
  int current = _trace++;
  if (current == 9999) {
    current = 1;
    _trace = current;
  }
  final Uint8List counter = IsoUtil.str2bcd(IsoUtil.padLeft(current.toString(), 4, "0"), true);
  final Uint8List sequence = Uint8List(4);
  sequence[0] = _random.nextInt(256);
  sequence[1] = _random.nextInt(256);
  sequence.setRange(2, 4, counter);
  return sequence;
}