LogCabin
|
#include <cassert>
#include <cmath>
#include <cstring>
#include <fcntl.h>
#include <limits>
#include <mutex>
#include <pthread.h>
#include <sys/stat.h>
#include <unistd.h>
#include "Core/Debug.h"
#include "Core/Random.h"
Go to the source code of this file.
Classes | |
class | LogCabin::Core::Random::anonymous_namespace{Random.cc}::RandomState |
Keeps state needed by the random number generator, protected by a mutex. More... | |
Namespaces | |
namespace | LogCabin |
namespace | LogCabin::Core |
namespace | LogCabin::Core::Random |
Thread-safe pseudo-random number generator. | |
namespace | LogCabin::Core::Random::anonymous_namespace{Random.cc} |
Functions | |
void | LogCabin::Core::Random::acquireMutex () |
Called before fork() to grab the mutex used in pthread_atfork. | |
void | LogCabin::Core::Random::releaseMutex () |
Called in the parent post fork(). | |
void | LogCabin::Core::Random::anonymous_namespace{Random.cc}::resetRandomState () |
Called in child after fork() to reset random seed. | |
template<typename T > | |
T | LogCabin::Core::Random::anonymous_namespace{Random.cc}::getRandomBytes () |
Fill a variable of type T with some random bytes. | |
double | LogCabin::Core::Random::anonymous_namespace{Random.cc}::randomUnit () |
Return a random number between 0 and 1. | |
uint8_t | LogCabin::Core::Random::random8 () |
Return one random byte. | |
uint16_t | LogCabin::Core::Random::random16 () |
Return two random bytes. | |
uint32_t | LogCabin::Core::Random::random32 () |
Return four random bytes. | |
uint64_t | LogCabin::Core::Random::random64 () |
Return eight random bytes. | |
double | LogCabin::Core::Random::randomRangeDouble (double start, double end) |
Return a random floating point number between start and end, inclusive. | |
uint64_t | LogCabin::Core::Random::randomRange (uint64_t start, uint64_t end) |
Return a random integer between start and end, inclusive. | |
Variables | |
class LogCabin::Core::Random::anonymous_namespace{Random.cc}::RandomState | LogCabin::Core::Random::anonymous_namespace{Random.cc}::randomState |