generateUniqueRandom static method

BuBytes generateUniqueRandom({
  1. int length = 32,
  2. List<List<int>> existingKeys = const [],
})

Implementation

static BuBytes generateUniqueRandom({
  int length = 32,
  List<List<int>> existingKeys = const [],
}) {
  BuBytes rand = generateRandom(length: length);
  if (existingKeys.isEmpty) return rand;
  while (BytesUtils.isContains(existingKeys, rand)) {
    rand = QuickCrypto.generateRandom(length: length);
  }
  return rand;
}