| 159 | } |
| 160 | |
| 161 | inline 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 | |
| 170 | double fast_rand_double() { |
| 171 | if (need_init(_tls_seed)) { |