Add Random::fast_bool.
GitOrigin-RevId: 1f7ec3d4a04dcadbdffde18994e7a29f3d22aedc
This commit is contained in:
parent
6d1d227609
commit
291a9ff43b
@ -148,6 +148,10 @@ double Random::fast(double min, double max) {
|
||||
return min + fast_uint32() * 1.0 / std::numeric_limits<uint32>::max() * (max - min);
|
||||
}
|
||||
|
||||
bool Random::fast_bool() {
|
||||
return (fast_uint32() & 1) != 0;
|
||||
}
|
||||
|
||||
Random::Xorshift128plus::Xorshift128plus(uint64 seed) {
|
||||
auto next = [&] {
|
||||
// splitmix64
|
||||
|
@ -35,6 +35,7 @@ class Random {
|
||||
// distribution is not uniform, min and max are included
|
||||
static int fast(int min, int max);
|
||||
static double fast(double min, double max);
|
||||
static bool fast_bool();
|
||||
|
||||
class Fast {
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user