proxygen
|
#include <Random.h>
Public Types | |
using | result_type = uint32_t |
Public Member Functions | |
result_type | operator() () |
Static Public Member Functions | |
static constexpr result_type | min () |
static constexpr result_type | max () |
A PRNG with one instance per thread. This PRNG uses a mersenne twister random number generator and is seeded from /dev/urandom. It should not be used for anything which requires security, only for statistical randomness.
An instance of this class represents the current threads PRNG. This means copying an instance of this class across threads will result in corruption
Most users will use the Random class which implicitly creates this class. However, if you are worried about performance, you can memoize the TLS lookups that get the per thread state by manually using this class:
ThreadLocalPRNG rng; for (...) { Random::rand32(rng); }
|
inlinestatic |
|
inlinestatic |
Definition at line 58 of file Random.h.
References min.
Referenced by folly::Random::rand32(), folly::Random::rand64(), and folly::Random::randDouble().
ThreadLocalPRNG::result_type folly::ThreadLocalPRNG::operator() | ( | ) |
Definition at line 164 of file Random.cpp.
References folly::Random::create(), and folly::pushmi::operators::get.