MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / RandomString

Function RandomString

external/sentencepiece/src/model_interface_test.cc:279–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279std::string RandomString(int length) {
280 const char kAlphaNum[] =
281 "0123456789"
282 "!@#$%^&*"
283 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
284 "abcdefghijklmnopqrstuvwxyz";
285 const int kAlphaSize = sizeof(kAlphaNum) - 1;
286 const int size = rand() % length + 1;
287 std::string result;
288 for (int i = 0; i < size; ++i) {
289 result += kAlphaNum[rand() % kAlphaSize];
290 }
291 return result;
292}
293
294TEST(ModelInterfaceTest, PieceToIdStressTest) {
295 for (const auto type : kModelTypes) {

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected