MCPcopy Create free account
hub / github.com/apache/impala / RandomString

Function RandomString

be/src/kudu/util/random_util.cc:36–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace kudu {
35
36void RandomString(void* dest, size_t n, Random* rng) {
37 size_t i = 0;
38 uint32_t random = rng->Next();
39 char* cdest = static_cast<char*>(dest);
40 static const size_t sz = sizeof(random);
41 if (n >= sz) {
42 for (i = 0; i <= n - sz; i += sz) {
43 memcpy(&cdest[i], &random, sizeof(random));
44 random = rng->Next();
45 }
46 }
47 memcpy(cdest + i, &random, n - i);
48}
49
50string RandomString(size_t n, Random* rng) {
51 faststring s;

Callers 10

TEST_FFunction · 0.85
TEST_FFunction · 0.85
DoSendTwoStringsMethod · 0.85
DoTestSidecarMethod · 0.85
TEST_PFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
BenchmarkFunction · 0.85
TESTFunction · 0.85

Calls 4

resizeMethod · 0.80
NextMethod · 0.45
dataMethod · 0.45
ToStringMethod · 0.45

Tested by 10

TEST_FFunction · 0.68
TEST_FFunction · 0.68
DoSendTwoStringsMethod · 0.68
DoTestSidecarMethod · 0.68
TEST_PFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
BenchmarkFunction · 0.68
TESTFunction · 0.68