MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / getRandomChars

Function getRandomChars

native/Base.h:367–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365 static const char AlphabetChSeq[AlphabetChSeqLen] = "你好中文字符串|。,;()【】?!测试啊哈"; // len 64
366
367 inline std::string getRandomChars() {
368 std::stringstream randomStringStream;
369 int len = randomInt(11, 1000);
370 auto seed = (unsigned int) std::time(nullptr);
371 while (len-- > 0) {
372 std::srand(len * 2 ^ 8 + seed);
373 int rand = std::rand();
374 int i = rand % (AlphabetSeqLen * 4 + AlphabetChSeqLen);
375 if (i < AlphabetSeqLen * 4) {
376 i /= 4;
377 randomStringStream << AlphabetSeq[i];
378 } else {
379 i -= (AlphabetSeqLen * 4);
380 i = i / 3 * 3;
381 randomStringStream << AlphabetChSeq[i] << AlphabetChSeq[i + 1]
382 << AlphabetChSeq[i + 2];
383 len -= 2;
384 }
385 }
386 return randomStringStream.str();
387 }
388
389}
390#endif //BASE_H_

Callers

nothing calls this directly

Calls 2

randomIntFunction · 0.85
strMethod · 0.45

Tested by

no test coverage detected