MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / random_string

Function random_string

subprojects/llama.cpp/tests/test-jinja.cpp:1889–1900  ·  view source on GitHub ↗

Helper to generate random string

Source from the content-addressed store, hash-verified

1887
1888// Helper to generate random string
1889static std::string random_string(std::mt19937 & rng, size_t max_len) {
1890 static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
1891 std::uniform_int_distribution<size_t> len_dist(0, max_len);
1892 std::uniform_int_distribution<size_t> char_dist(0, sizeof(charset) - 2);
1893 size_t len = len_dist(rng);
1894 std::string result;
1895 result.reserve(len);
1896 for (size_t i = 0; i < len; ++i) {
1897 result += charset[char_dist(rng)];
1898 }
1899 return result;
1900}
1901
1902// Helper to execute a fuzz test case - returns true if no crash occurred
1903static bool fuzz_test_template(const std::string & tmpl, const json & vars) {

Callers 1

test_fuzzingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected