randomNonZeroHex static method

String randomNonZeroHex(
  1. int byteCount
)

Implementation

static String randomNonZeroHex(int byteCount) {
  final random = Random.secure();
  late List<int> bytes;
  do {
    bytes = List<int>.generate(byteCount, (_) => random.nextInt(256));
  } while (bytes.every((byte) => byte == 0));
  return bytes.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join();
}