create rng ouside loop & improve readme

This commit is contained in:
Mans Ziesel 2024-04-28 14:02:45 +02:00
parent 2a033ecb81
commit 7ca991af07
2 changed files with 5 additions and 3 deletions

View File

@ -8,3 +8,5 @@ example output:
``` ```
retrace-choice-litter-dreamt-zipping retrace-choice-litter-dreamt-zipping
``` ```
This project uses the [EFF's Wordlists for Random Passphrases](https://www.eff.org/deeplinks/2016/07/new-wordlists-random-passphrases) and [PCG random](https://www.pcg-random.org/) to pick random words

View File

@ -45,10 +45,10 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
for (int i = 0; i < count; i++) { pcg_extras::seed_seq_from<std::random_device> seed_source;
pcg_extras::seed_seq_from<std::random_device> seed_source; pcg32 rng(seed_source);
pcg32 rng(seed_source);
for (int i = 0; i < count; i++) {
int random_int = std::uniform_int_distribution<int>(0, wordlist.size())(rng); int random_int = std::uniform_int_distribution<int>(0, wordlist.size())(rng);
std::cout << wordlist[random_int]; std::cout << wordlist[random_int];