MCPcopy Create free account
hub / github.com/apache/arrow / random_alnum

Function random_alnum

cpp/src/arrow/testing/util.cc:93–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void random_alnum(int64_t n, uint32_t seed, uint8_t* out) {
94 static const char charset[] =
95 "0123456789"
96 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
97 "abcdefghijklmnopqrstuvwxyz";
98 pcg32_fast gen(seed);
99 std::uniform_int_distribution<uint32_t> d(0, sizeof(charset) - 2);
100 std::generate(out, out + n, [&d, &gen] { return charset[d(gen)]; });
101}
102
103int64_t CountNulls(const std::vector<uint8_t>& valid_bytes) {
104 return static_cast<int64_t>(std::count(valid_bytes.cbegin(), valid_bytes.cend(), '\0'));

Callers 1

SetUpMethod · 0.85

Calls

no outgoing calls

Tested by 1

SetUpMethod · 0.68