20#include "jenkins/lookup3.h"
23#define PCG_LITTLE_ENDIAN 1
24#include "pcg-cpp/pcg_random.hpp"
40 Random(
const Uint32 initialSeed = 0xabcd1234)
46 Random(
const Uint32 *
const seeds,
size_t length)
53 Random(
const Uint64 *
const seeds,
size_t length)
55 seed(
reinterpret_cast<const Uint32 *
>(seeds), length * 2);
63 void seed(
const Uint32 *
const seeds,
size_t length)
65 const Uint32 hash = lookup3_hashword(seeds, length, 0);
71 void seed(
const Uint64 *
const seeds,
size_t length)
73 seed(
reinterpret_cast<const Uint32 *
>(seeds), length * 2);
77 void seed(
const Uint32 value)
100 inline Uint32
Int32(
const int choices)
102 return Int32() % choices;
107 inline int Int32(
const int min,
const int max)
109 return (
Int32() % (1 + max - min)) + min;
115 return double(
Int32()) * (1. / 4294967296.);
121 return double(
Int32()) * (1. / 4294967295.);
127 return (
double(
Int32()) + .5) * (1. / 4294967296.);
134 return (
double(
Int32() >> 5) * 67108864. +
double(
Int32() >> 6)) * (1. / 9007199254740992.);
138 inline double Double(
double min,
double limit)
140 return Double(limit - min) + min;
185 inline double Normal(
const double mean,
const double stddev)
200 s = sqrt((-2.0 * log(s)) / s);
206 return mean + z0 * stddev;
213 const double target = exp(-lambda);
236 const pcg32 &
GetPCG()
const {
return mPCG; }
240 void operator=(
const Random &);
double Double_closed(double min, double max)
Definition Random.h:158
double Double(double min, double limit)
Definition Random.h:138
double NDouble(int p)
Definition Random.h:164
int Poisson(const double lambda)
Definition Random.h:209
double Double_closed()
Definition Random.h:119
double Double53()
Definition Random.h:132
fixed Fixed()
Definition Random.h:222
double Double()
Definition Random.h:113
double Double_closed(double max)
Definition Random.h:151
int Int32(const int min, const int max)
Definition Random.h:107
fixed NFixed(int p)
Definition Random.h:228
double Normal(const double mean)
Definition Random.h:179
double Normal()
Definition Random.h:173
double Double(double limit)
Definition Random.h:144
double Double_open()
Definition Random.h:125
Random(const Uint32 initialSeed=0xabcd1234)
Definition Random.h:40
void seed(const Uint32 value)
Definition Random.h:77
const pcg32 & GetPCG() const
Definition Random.h:236
Random(const Uint32 *const seeds, size_t length)
Definition Random.h:46
Uint32 Int32(const int choices)
Definition Random.h:100
Random(const Uint64 *const seeds, size_t length)
Definition Random.h:53
void seed(const Uint64 *const seeds, size_t length)
Definition Random.h:71
void seed(const Uint32 *const seeds, size_t length)
Definition Random.h:63
double Normal(const double mean, const double stddev)
Definition Random.h:185
Uint32 Int32()
Definition Random.h:92
Definition RefCounted.h:11
fixedf< 32 > fixed
Definition fixed.h:242