MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_drand

Function rte_drand

dpdk/lib/eal/common/rte_random.c:183–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183double
184rte_drand(void)
185{
186 static const uint64_t denom = (uint64_t)1 << 53;
187 uint64_t rand64 = rte_rand();
188
189 /*
190 * The double mantissa only has 53 bits, so we uniformly mask off the
191 * high 11 bits and then floating-point divide by 2^53 to achieve a
192 * result in [0, 1).
193 *
194 * We are not allowed to emit 1.0, so denom must be one greater than
195 * the possible range of the preceding step.
196 */
197
198 rand64 &= denom - 1;
199 return (double)rand64 / denom;
200}
201
202static uint64_t
203__rte_random_initial_seed(void)

Callers 2

_rte_pie_dropFunction · 0.85
test_rand_perf_typeFunction · 0.85

Calls 1

rte_randFunction · 0.85

Tested by 1

test_rand_perf_typeFunction · 0.68