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

Function MakeDistinctIntegers

cpp/src/arrow/util/hashing_test.cc:43–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42template <typename Integer>
43static std::unordered_set<Integer> MakeDistinctIntegers(int32_t n_values) {
44 std::default_random_engine gen(42);
45 std::uniform_int_distribution<Integer> values_dist(0,
46 std::numeric_limits<Integer>::max());
47
48 std::unordered_set<Integer> values;
49 values.reserve(n_values);
50
51 while (values.size() < static_cast<uint32_t>(n_values)) {
52 values.insert(static_cast<Integer>(values_dist(gen)));
53 }
54 return values;
55}
56
57template <typename Integer>
58static std::unordered_set<Integer> MakeSequentialIntegers(int32_t n_values) {

Callers

nothing calls this directly

Calls 3

reserveMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected