MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / random_string

Function random_string

src/tmp_dir.cpp:53–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_DEBUG_SAVE_TEMP_DIR)
52
53static std::string random_string(std::string::size_type length)
54{
55 static const std::string& chars = "0123456789"
56 "abcdefghijklmnopqrstuvwxyz"
57 "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
58
59 std::mt19937 rg{std::random_device{}()};
60 std::uniform_int_distribution<std::string::size_type> pick(0, chars.length() - 1);
61
62 std::string str(length, 0);
63 std::generate(str.begin(), str.end(), [&] { return chars[pick(rg)]; });
64
65 return str;
66}
67
68static std::string unique_string(const std::string& prefix)
69{

Callers 1

unique_stringFunction · 0.85

Calls 3

generateFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected