MCPcopy Create free account
hub / github.com/apache/thrift / gen_random_buffer

Function gen_random_buffer

lib/cpp/test/ZlibTest.cpp:131–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131boost::shared_array<uint8_t> gen_random_buffer(uint32_t buf_len) {
132 auto* buf = new uint8_t[buf_len];
133
134 boost::uniform_smallint<uint8_t> distribution(0, UINT8_MAX);
135 boost::variate_generator<boost::mt19937, boost::uniform_smallint<uint8_t> >
136 generator(rng, distribution);
137
138 for (uint32_t n = 0; n < buf_len; ++n) {
139 buf[n] = generator();
140 }
141
142 return boost::shared_array<uint8_t>(buf);
143}
144
145/*
146 * Test functions

Callers 1

init_unit_test_suiteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected