#include <random.h>
Definition at line 15 of file random.h.
§ Random()
| leveldb::Random::Random |
( |
uint32_t |
s | ) |
|
|
inlineexplicit |
§ Next()
| uint32_t leveldb::Random::Next |
( |
| ) |
|
|
inline |
Definition at line 25 of file random.h.
26 static const uint32_t M = 2147483647L;
27 static const uint64_t A = 16807;
34 uint64_t product =
seed_ * A;
37 seed_ =
static_cast<uint32_t
>((product >> 31) + (product & M));
§ OneIn()
| bool leveldb::Random::OneIn |
( |
int |
n | ) |
|
|
inline |
Definition at line 52 of file random.h.
52 {
return (
Next() % n) == 0; }
§ Skewed()
| uint32_t leveldb::Random::Skewed |
( |
int |
max_log | ) |
|
|
inline |
§ Uniform()
| uint32_t leveldb::Random::Uniform |
( |
int |
n | ) |
|
|
inline |
§ seed_
| uint32_t leveldb::Random::seed_ |
|
private |
The documentation for this class was generated from the following file: