MCPcopy Create free account
hub / github.com/apache/brpc / fast_rand_double

Function fast_rand_double

src/butil/fast_rand.cpp:161–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161inline double fast_rand_double(FastRandSeed* seed) {
162 // Copied from rand_util.cc
163 COMPILE_ASSERT(std::numeric_limits<double>::radix == 2, otherwise_use_scalbn);
164 static const int kBits = std::numeric_limits<double>::digits;
165 uint64_t random_bits = xorshift128_next(seed) & ((UINT64_C(1) << kBits) - 1);
166 double result = ldexp(static_cast<double>(random_bits), -1 * kBits);
167 return result;
168}
169
170double fast_rand_double() {
171 if (need_init(_tls_seed)) {

Callers 2

TESTFunction · 0.85
double_to_random_intFunction · 0.85

Calls 3

xorshift128_nextFunction · 0.85
need_initFunction · 0.85
init_fast_rand_seedFunction · 0.85

Tested by 1

TESTFunction · 0.68