secretRandomWords static method

List<String> secretRandomWords({
  1. required int totalCount,
  2. required GenerateSecretWords generateSecretWords,
  3. String schema = "0123456789abcdefghijklmnopqrstuvwxyz",
})

Implementation

static List<String> secretRandomWords({
  required int totalCount,
  required GenerateSecretWords generateSecretWords,
  String schema = "0123456789abcdefghijklmnopqrstuvwxyz",
}) {
  List<String> secretWords = [];

  while (true) {
    if (secretWords.length == totalCount) {
      return secretWords;
    } else {
      String randomWord =
          generateUuid(generateSecretWords.totalLength(), text: schema);
      if (!secretWords.contains(randomWord)) {
        secretWords.add(randomWord);
      }
    }
  }
}