This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
VectorSearch/word_list_generator.cpp

35 lines
892 B
C++

#include "word_list_generator.h"
#include <algorithm>
#include <cmath>
#include <random>
const std::string WordListGenerator::charset_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::vector<std::string> WordListGenerator::generate() {
const size_t multiplier = 10;
std::vector<std::string> result;
result.reserve(multiplier * std::pow(charset_.length(), 4));
for (auto char_1 : charset_) {
for (auto char_2 : charset_) {
for (auto char_3 : charset_) {
for (auto char_4 : charset_) {
for (auto i = 0; i < multiplier; ++i) {
result.emplace_back(
std::initializer_list<char>({char_1, char_2, char_3, char_4}));
}
}
}
}
}
std::random_device random_device;
std::mt19937 random_number_generator(random_device());
std::shuffle(result.begin(), result.end(), random_number_generator);
return result;
}