MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / randomString

Function randomString

KittyMemoryEx/KittyUtils.cpp:24–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 }
23
24 std::string randomString(size_t length)
25 {
26 static const std::string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
27
28 static std::mutex mtx;
29 std::lock_guard<std::mutex> lock(mtx);
30
31 static std::default_random_engine rnd(std::random_device{}());
32
33 std::uniform_int_distribution<std::string::size_type> dist(0, chars.size() - 1);
34
35 std::string str(length, '\0');
36 for (size_t i = 0; i < length; ++i)
37 str[i] = chars[dist(rnd)];
38
39 return str;
40 }
41
42#ifdef __ANDROID__
43 int Android::getVersion()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected