MCPcopy Create free account
hub / github.com/comaps/comaps / GenerateRandomString

Function GenerateRandomString

libs/coding/coding_tests/text_storage_tests.cpp:18–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17template <typename Engine>
18string GenerateRandomString(Engine & engine)
19{
20 int const kMinLength = 0;
21 int const kMaxLength = 400;
22
23 int const kMinByte = 0;
24 int const kMaxByte = 255;
25
26 uniform_int_distribution<int> length(kMinLength, kMaxLength);
27 uniform_int_distribution<int> byte(kMinByte, kMaxByte);
28 string s(length(engine), '\0');
29 for (auto & b : s)
30 b = byte(engine);
31 return s;
32}
33
34void DumpStrings(vector<string> const & strings, uint64_t blockSize, vector<uint8_t> & buffer)
35{

Callers 1

UNIT_TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected