MCPcopy Create free account
hub / github.com/Tencent/phxqueue / GenRandomString

Function GenRandomString

phxqueue_phxrpc/test/test_producer_echo_main.cpp:34–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void GenRandomString(char *s, const int len) {
35 static const char alpha_num[] =
36 "0123456789"
37 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
38 "abcdefghijklmnopqrstuvwxyz";
39
40 srand(time(nullptr));
41 for (int i = 0; i < len; ++i) {
42 s[i] = alpha_num[rand() % (sizeof(alpha_num) - 1)];
43 }
44
45 s[len] = '\0';
46}
47
48int main(int argc, char **argv) {
49 const char *module_name{program_invocation_short_name};

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected