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

Function MakeRandomBytes

cpp/src/arrow/util/rle_bitmap_test.cc:36–44  ·  view source on GitHub ↗

Make a vector of `size` pseudo-random bytes, deterministic for a given `seed`.

Source from the content-addressed store, hash-verified

34
35/// Make a vector of `size` pseudo-random bytes, deterministic for a given `seed`.
36std::vector<uint8_t> MakeRandomBytes(size_t size, uint32_t seed = 56) {
37 std::vector<uint8_t> bytes(size);
38 std::minstd_rand gen(seed);
39 std::uniform_int_distribution<int> dist(0, 255); // no standard support for uint8_t
40 for (auto& byte : bytes) {
41 byte = static_cast<uint8_t>(dist(gen));
42 }
43 return bytes;
44}
45
46/// Read the first `count` bits of `bytes` (LSB first) into a vector of booleans.
47std::vector<bool> BitsFromBytes(const std::vector<uint8_t>& bytes, rle_size_t count) {

Callers 1

CheckDecoderClobberFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected