generateSpanId static method

Uint8List generateSpanId()

Generate an 8-byte span ID. Returns bytes which can be formatted as a 16-char hex string.

Implementation

static Uint8List generateSpanId() {
  final bytes = Uint8List(8);

  // Generate random bytes until we get a non-zero ID
  do {
    _random.fillBytes(bytes);
  } while (_isZero(bytes));

  return bytes;
}