MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / random_string

Function random_string

tests/memcmp_test.cpp:30–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28using namespace sonic_json::internal::avx2;
29
30static std::string random_string(int str_len) {
31 // const char * strs =
32 // "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()这是一个字符串";
33 std::string re;
34
35 std::random_device rd;
36 std::mt19937 gen(rd());
37 for (int i = 0; i < str_len; ++i) {
38 char c = gen() % 26 + 'a';
39 re.append(1, c);
40 }
41 return re;
42}
43
44bool is_correct(int a, int b) {
45 if (a < 0) return b < 0;

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected