MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / random_string

Function random_string

smallthinker/tools/server/utils.hpp:456–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454//
455
456static std::string random_string() {
457 static const std::string str("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
458
459 std::random_device rd;
460 std::mt19937 generator(rd());
461
462 std::string result(32, ' ');
463
464 for (int i = 0; i < 32; ++i) {
465 result[i] = str[generator() % str.size()];
466 }
467
468 return result;
469}
470
471static std::string gen_chatcmplid() {
472 return "chatcmpl-" + random_string();

Callers 2

gen_chatcmplidFunction · 0.70
gen_tool_call_idFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected