calcNonce function

int calcNonce()

Calculate a random number for nonce

Implementation

int calcNonce() {
  final random = Random.secure();
  int length = 8;
  String chars = '0123456789ABCDEF';
  String hex = '';
  while (length-- > 0) {
    hex += chars[(random.nextInt(16)) | 0];
  }
  return int.parse(hex, radix: 16);
}