MCPcopy Create free account
hub / github.com/apache/impala / MakeNonNegativeRand

Function MakeNonNegativeRand

be/src/benchmarks/bitmap-benchmark.cc:73–82  ·  view source on GitHub ↗

Make a random non-negative int64_t, avoiding the absent high bit and the low-entropy low bits produced by rand().

Source from the content-addressed store, hash-verified

71// Make a random non-negative int64_t, avoiding the absent high bit and the low-entropy
72// low bits produced by rand().
73int64_t MakeNonNegativeRand() {
74 int64_t result = (rand() >> 8) & 0x7fff;
75 result <<= 16;
76 result |= (rand() >> 8) & 0xffff;
77 result <<= 16;
78 result |= (rand() >> 8) & 0xffff;
79 result <<= 15;
80 result |= (rand() >> 8) & 0xffff;
81 return result;
82}
83
84// Just benchmark the constructor and destructor cost
85namespace bitmapinitialize {

Callers 1

TestDataMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestDataMethod · 0.68