PCG (Permuted Congruential Generator) Extended is a C# port from C++ of a part of the extended PCG family of generators presented in "PCG: A Family of Simple Fast Space-Efficient Statistically Good
Algorithms for Random Number Generation" by Melissa E. O'Neill. The code follows closely the one made available by O'Neill at her site: http://www.pcg-random.org/using-pcg-cpp.html To understand how exactly this generator works read this: http://www.pcg-random.org/pdf/toms-oneill-pcg-family-v1.02.pdf its a fun read, enjoy! The most important difference between this version and PCG is that the generators produced by this class can have extremely large periods (extremely!) and have configurable k-dimensional equidistribution. All this at a very small speed penalty! (Upto 1024-dimensionally equidistributed generators perform faster than System.Random, at least on the machines I have access to). Fun fact, the period of PCG Extended for _table_mask = 14 is 2^(524352) which is more than 10^(157846). To put this in context, the number particles in the known Universe is about 10^(80 to 81ish) if we also count photons that number goes up (with a lot of effort) to 10^(90ish). Now, there are estimates that say that visible matter (counting photons, energy-matter same thing...) accounts for 5% of the matter in the visible Universe, so if these estimates are correct the total visible+invisible particles/(energy particles) in the visible Universe would approximately be 10^(91). That means that this generator has a period that is 157755 orders of magnitude larger than the number of all particles in the visible Universe... Also, if the universe had an equal number of particles (to the period of PCG 14), that would mean that its mean density (at its current volume) would be so high that the entire Universe would collapse unto its weight into a black hole.
More...
|
int | Next () |
| Random integer in the interval [0, int.MaxValue]. More...
|
|
int | Next (int maxExclusive) |
| Random integer in the semi-open interval [0, maxExclusive ). More...
|
|
int | Next (int minInclusive, int maxExclusive) |
| Random integer in the interval [minInclusive , maxExclusive ). More...
|
|
int[] | NextInts (int count) |
| Array of size count of random integers in the interval [0, int.MaxValue]. More...
|
|
int[] | NextInts (int count, int maxExclusive) |
| Array of size count of random integers in the interval [0, maxExclusive ). More...
|
|
int[] | NextInts (int count, int minInclusive, int maxExclusive) |
| Array of size count of random integers in the interval [minInclusive , maxExclusive ). More...
|
|
uint | NextUInt () |
| Random unsigned integer in the interval [0, uint.MaxValue]. More...
|
|
uint | NextUInt (uint maxExclusive) |
| Random unsigned integer in the interval [0, maxExclusive ). More...
|
|
uint | NextUInt (uint minInclusive, uint maxExclusive) |
| Random unsigned integer in the interval [minInclusive , maxExclusive ). More...
|
|
uint[] | NextUInts (int count) |
| Array of size count of unsigned integers in the interval [0, uint.MaxValue]. More...
|
|
uint[] | NextUInts (int count, uint maxExclusive) |
| Array of size count of unsigned integers in the interval [0, maxExclusive ). More...
|
|
uint[] | NextUInts (int count, uint minInclusive, uint maxExclusive) |
| Array of size count of unsigned integers in the interval [minInclusive , maxExclusive ). More...
|
|
float | NextFloat () |
| Random single precision floating point number in the interval [0,1]. More...
|
|
float | NextFloat (float maxInclusive) |
| Random single precision floating point number in the interval [0, maxInclusive ]. More...
|
|
float | NextFloat (float minInclusive, float maxInclusive) |
| Random single precision floating point number in the interval [minInclusive , maxInclusive ]. More...
|
|
float[] | NextFloats (int count) |
| Array of size count of single precision floating point random numbers in the interval [0,1]. More...
|
|
float[] | NextFloats (int count, float maxInclusive) |
| Array of size count of single precision floating point random numbers in the interval [0, maxInclusive ]. More...
|
|
float[] | NextFloats (int count, float minInclusive, float maxInclusive) |
| Array of size count of single precision floating point random numbers in the interval [minInclusive , maxInclusive ]. More...
|
|
double | NextDouble () |
| Random double precision floating point number in the interval [0, 1]. More...
|
|
double | NextDouble (double maxInclusive) |
| Random double precision floating point number in the interval [0, maxInclusive ]. More...
|
|
double | NextDouble (double minInclusive, double maxInclusive) |
| Random double precision floating point number in the interval [minInclusive , maxInclusive ]. More...
|
|
double[] | NextDoubles (int count) |
| Array of size count of double precision floating point random numbers in the interval [0, 1]. More...
|
|
double[] | NextDoubles (int count, double maxInclusive) |
| Array of size count of double precision floating point random numbers in the interval [0, maxInclusive . More...
|
|
double[] | NextDoubles (int count, double minInclusive, double maxInclusive) |
| Array of size count of double precision floating point random numbers in the interval [minInclusive , maxInclusive ]. More...
|
|
byte | NextByte () |
| Random byte. More...
|
|
byte[] | NextBytes (int count) |
| Array of size count of random bytes. More...
|
|
bool | NextBool () |
| Random boolean. More...
|
|
bool[] | NextBools (int count) |
| Array of size count of random booleans. More...
|
|
int | Equidistribution () |
| Equidistribution this generator. More...
|
|
int | EquidistributionPow2 () |
| Power of two exponent of the equidistribution of this generator. More...
|
|
int | PeriodPow2 () |
| Base 2 exponent of the period of this generator, i.e. Period of Generator = 2^PeriodPow2(). More...
|
|
void | SetStream (int sequence) |
| Set the stream for this generator. More...
|
|
void | SetStream (ulong sequence) |
| Set the stream for this generator. More...
|
|
ulong | CurrentStream () |
| Query the current stream used by this generator. More...
|
|
| PcgExtended () |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (int seed) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (ulong seed) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (int seed, int sequence) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (ulong seed, ulong sequence) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (int seed, int tablePow2, int advancePow2) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (ulong seed, int tablePow2, int advancePow2) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (int seed, int sequence, int tablePow2, int advancePow2) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
| PcgExtended (ulong seed, ulong sequence, int tablePow2, int advancePow2) |
| Initializes a new instance of the T:Crystal.PcgExtended class. More...
|
|
PCG (Permuted Congruential Generator) Extended is a C# port from C++ of a part of the extended PCG family of generators presented in "PCG: A Family of Simple Fast Space-Efficient Statistically Good
Algorithms for Random Number Generation" by Melissa E. O'Neill. The code follows closely the one made available by O'Neill at her site: http://www.pcg-random.org/using-pcg-cpp.html To understand how exactly this generator works read this: http://www.pcg-random.org/pdf/toms-oneill-pcg-family-v1.02.pdf its a fun read, enjoy! The most important difference between this version and PCG is that the generators produced by this class can have extremely large periods (extremely!) and have configurable k-dimensional equidistribution. All this at a very small speed penalty! (Upto 1024-dimensionally equidistributed generators perform faster than System.Random, at least on the machines I have access to). Fun fact, the period of PCG Extended for _table_mask = 14 is 2^(524352) which is more than 10^(157846). To put this in context, the number particles in the known Universe is about 10^(80 to 81ish) if we also count photons that number goes up (with a lot of effort) to 10^(90ish). Now, there are estimates that say that visible matter (counting photons, energy-matter same thing...) accounts for 5% of the matter in the visible Universe, so if these estimates are correct the total visible+invisible particles/(energy particles) in the visible Universe would approximately be 10^(91). That means that this generator has a period that is 157755 orders of magnitude larger than the number of all particles in the visible Universe... Also, if the universe had an equal number of particles (to the period of PCG 14), that would mean that its mean density (at its current volume) would be so high that the entire Universe would collapse unto its weight into a black hole.