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

Function random_byte_array

cpp/src/parquet/test_util.cc:120–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void random_byte_array(int n, uint32_t seed, uint8_t* buf, ByteArray* out, int min_size,
121 int max_size) {
122 std::default_random_engine gen(seed);
123 std::uniform_int_distribution<int> d1(min_size, max_size);
124 std::uniform_int_distribution<int> d2(0, 255);
125 for (int i = 0; i < n; ++i) {
126 int len = d1(gen);
127 out[i].len = len;
128 out[i].ptr = buf;
129 for (int j = 0; j < len; ++j) {
130 buf[j] = static_cast<uint8_t>(d2(gen));
131 }
132 buf += len;
133 }
134}
135
136void random_byte_array(int n, uint32_t seed, uint8_t* buf, ByteArray* out, int max_size) {
137 random_byte_array(n, seed, buf, out, 0, max_size);

Callers 3

InitValues<ByteArray>Function · 0.85
InitWideByteArrayValuesFunction · 0.85
GenerateData<ByteArray>Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected