Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions lib/view_model/verify_seed_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ abstract class VerifySeedViewModelBase extends ViewModel with Store {
String get randomWord => seedWords[randomIndex];

late final List<String> randomWords = () {
final w = wordList;
w.shuffle(Random.secure());
final elms = w.take(5).toList();
elms.add(randomWord);
elms.toSet(); // in case we got a duplicate
return elms.toList()..shuffle(Random.secure());
// Copy before shuffling, wordList is shared (Bip39.english is a static).
final shuffled = List<String>.of(wordList)..shuffle(Random.secure());
// Drop the correct word so it cannot show up as a decoy as well.
final decoys = shuffled.toSet()..remove(randomWord);
return [...decoys.take(5), randomWord]..shuffle(Random.secure());
}();

bool result(final String guessedWord) {
Expand Down