MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / randomize_strings

Function randomize_strings

scripts/test_stringzilla.hpp:220–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218};
219
220inline void randomize_strings(fuzzy_config_t config, std::vector<std::string> &array, bool unique = false) {
221 array.resize(config.batch_size);
222
223 std::uniform_int_distribution<std::size_t> length_distribution(config.min_string_length, config.max_string_length);
224 for (std::size_t i = 0; i != config.batch_size; ++i) {
225 std::size_t length = length_distribution(global_random_generator());
226 array[i] = random_string(length, config.alphabet.data(), config.alphabet.size());
227 }
228
229 if (unique) {
230 std::sort(array.begin(), array.end());
231 auto last = std::unique(array.begin(), array.end());
232 array.erase(last, array.end());
233 }
234}
235
236inline void randomize_strings(fuzzy_config_t config, std::vector<std::string> &array, arrow_strings_tape_t &tape,
237 bool unique = false) {

Callers

nothing calls this directly

Calls 8

random_stringFunction · 0.85
resizeMethod · 0.80
eraseMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
try_assignMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…