MCPcopy Create free account
hub / github.com/acidicoala/SmokeAPI / generate_random_string

Function generate_random_string

tools/src/steamworks_downloader.cpp:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 namespace kb = koalabox;
16
17 std::string generate_random_string() {
18 static constexpr char charset[] = "0123456789"
19 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
20 "abcdefghijklmnopqrstuvwxyz";
21
22 thread_local std::mt19937_64 rng{std::random_device{}()};
23 thread_local std::uniform_int_distribution<std::size_t> dist(0, sizeof(charset) - 2);
24
25 constexpr auto length = 16;
26 std::string result;
27 result.reserve(length);
28 for(std::size_t i = 0; i < length; ++i) {
29 result += charset[dist(rng)];
30 }
31
32 return result;
33 }
34
35 void print_help() {
36 LOG_INFO(

Callers 1

download_sdkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected