libfoedus-core
FOEDUS Core Library
|
A very simple and deterministic random generator that is more aligned with standard benchmark such as TPC-C. More...
A very simple and deterministic random generator that is more aligned with standard benchmark such as TPC-C.
Actually this is exactly from TPC-C spec.
Definition at line 35 of file uniform_random.hpp.
#include <uniform_random.hpp>
Public Member Functions | |
UniformRandom () | |
UniformRandom (uint64_t seed) | |
uint32_t | uniform_within (uint32_t from, uint32_t to) |
In TPCC terminology, from=x, to=y. More... | |
uint32_t | uniform_within_except (uint32_t from, uint32_t to, uint32_t except) |
Same as uniform_within() except it avoids the "except" value. More... | |
uint32_t | non_uniform_within (uint32_t A, uint32_t from, uint32_t to) |
Non-Uniform random (NURand) in TPCC spec (see Sec 2.1.6). More... | |
uint64_t | get_current_seed () const |
void | set_current_seed (uint64_t seed) |
void | fill_memory (foedus::memory::AlignedMemory *memory) |
Fill up the give memory with random data. More... | |
uint64_t | next_uint64 () |
uint32_t | next_uint32 () |
|
inline |
Definition at line 37 of file uniform_random.hpp.
|
inlineexplicit |
Definition at line 38 of file uniform_random.hpp.
void foedus::assorted::UniformRandom::fill_memory | ( | foedus::memory::AlignedMemory * | memory | ) |
Fill up the give memory with random data.
Call this to pre-calculate many random numbers. When the function we test is very fast, generating random numbers might become the bottleneck. This method is to avoid it. Use this like following:
Definition at line 23 of file uniform_random.cpp.
References foedus::memory::AlignedMemory::get_block(), foedus::memory::AlignedMemory::get_size(), and next_uint32().
|
inline |
Definition at line 75 of file uniform_random.hpp.
Referenced by foedus::assorted::ZipfianRandom::get_current_seed().
|
inline |
Definition at line 106 of file uniform_random.hpp.
Referenced by foedus::storage::masstree::design_partition_first_parallel_recurse(), fill_memory(), foedus::assorted::ProbCounter::increment(), next_uint64(), uniform_within(), and foedus::assorted::SpinlockStat::yield_backoff().
|
inline |
Definition at line 103 of file uniform_random.hpp.
References next_uint32().
|
inline |
Non-Uniform random (NURand) in TPCC spec (see Sec 2.1.6).
In TPCC terminology, from=x, to=y. NURand(A, x, y) = (((random(0, A) | random(x, y)) + C) % (y - x + 1)) + x
Definition at line 70 of file uniform_random.hpp.
References uniform_within().
|
inline |
Definition at line 78 of file uniform_random.hpp.
Referenced by foedus::assorted::ZipfianRandom::init(), foedus::assorted::ZipfianRandom::set_current_seed(), foedus::thread::Thread::Thread(), and foedus::assorted::SpinlockStat::yield_backoff().
|
inline |
In TPCC terminology, from=x, to=y.
NOTE both from and to are inclusive.
Definition at line 44 of file uniform_random.hpp.
References ASSERT_ND, and next_uint32().
Referenced by foedus::storage::masstree::SplitBorder::decide_strategy(), foedus::assorted::ZipfianRandom::next(), non_uniform_within(), and uniform_within_except().
|
inline |
Same as uniform_within() except it avoids the "except" value.
Make sure from!=to.
Definition at line 55 of file uniform_random.hpp.
References uniform_within().