16#include <initializer_list>
22#include "jenkins/lookup3.h"
25#define PCG_LITTLE_ENDIAN 1
26#include "pcg-cpp/pcg_random.hpp"
42 Random(
const Uint32 initialSeed = 0xabcd1234)
48 Random(
const Uint32 *
const seeds,
size_t length)
55 Random(
const Uint64 *
const seeds,
size_t length)
57 seed(
reinterpret_cast<const Uint32 *
>(seeds), length * 2);
61 Random(std::initializer_list<uint32_t> seeds)
71 void seed(
const Uint32 *
const seeds,
size_t length)
73 const Uint32 hash = lookup3_hashword(seeds, length, 0);
79 void seed(
const Uint64 *
const seeds,
size_t length)
81 seed(
reinterpret_cast<const Uint32 *
>(seeds), length * 2);
85 void seed(std::initializer_list<uint32_t> list) {
86 seed(&*list.begin(), list.size());
90 void seed(
const Uint32 value)
113 inline Uint32
Int32(
const int choices)
115 return Int32() % choices;
128 return double(
Int32()) * (1. / 4294967296.);
134 return double(
Int32()) * (1. / 4294967295.);
140 return (
double(
Int32()) + .5) * (1. / 4294967296.);
147 return (
double(
Int32() >> 5) * 67108864. +
double(
Int32() >> 6)) * (1. / 9007199254740992.);
198 inline double Normal(
const double mean,
const double stddev)
213 s = sqrt((-2.0 * log(s)) / s);
219 return mean + z0 * stddev;
226 const double target = exp(-lambda);
266 const pcg32 &
GetPCG()
const {
return mPCG; }
270 void operator=(
const Random &);
fixed NormFixed(fixed mean, fixed maxdev)
Definition: Random.h:261
double Double_closed(double min, double max)
Definition: Random.h:171
double Double(double min, double limit)
Definition: Random.h:151
double NDouble(int p)
Definition: Random.h:177
void seed(std::initializer_list< uint32_t > list)
Definition: Random.h:85
int Poisson(const double lambda)
Definition: Random.h:222
double Double_closed()
Definition: Random.h:132
double Double53()
Definition: Random.h:145
fixed Fixed()
Definition: Random.h:235
double Double()
Definition: Random.h:126
Random(std::initializer_list< uint32_t > seeds)
Definition: Random.h:61
double Double_closed(double max)
Definition: Random.h:164
int Int32(const int min, const int max)
Definition: Random.h:120
fixed NormFixed()
Definition: Random.h:251
fixed NFixed(int p)
Definition: Random.h:241
double Normal(const double mean)
Definition: Random.h:192
double Normal()
Definition: Random.h:186
double Double(double limit)
Definition: Random.h:157
double Double_open()
Definition: Random.h:138
Random(const Uint32 initialSeed=0xabcd1234)
Definition: Random.h:42
void seed(const Uint32 value)
Definition: Random.h:90
const pcg32 & GetPCG() const
Definition: Random.h:266
Random(const Uint32 *const seeds, size_t length)
Definition: Random.h:48
Uint32 Int32(const int choices)
Definition: Random.h:113
Random(const Uint64 *const seeds, size_t length)
Definition: Random.h:55
void seed(const Uint64 *const seeds, size_t length)
Definition: Random.h:79
void seed(const Uint32 *const seeds, size_t length)
Definition: Random.h:71
double Normal(const double mean, const double stddev)
Definition: Random.h:198
Uint32 Int32()
Definition: Random.h:105
Definition: RefCounted.h:11
fixedf< 32 > fixed
Definition: fixed.h:242
vector3< T > max(const vector3< T > &lhs, const vector3< T > &rhs)
Definition: vector3.h:312
vector3< T > min(const vector3< T > &lhs, const vector3< T > &rhs)
Definition: vector3.h:320