C# (CSharp) RandomOps Namespace

Nested Namespaces

RandomOps.ThreadSafe

Сlasses

Name Description
ByteStream Base-class for an RNG which retrieves a stream of random bytes from somewhere, e.g. from a file, from the internet, or from a physical device such as a USB-device.
ByteStreamAsync A version of the ByteStream RNG base-class which works asynchronously by creating its own thread on which the buffer refilling is executed. This allows for immediate use of the fallback RNG instead of waiting for the buffer to be refilled, and is preferred for time-critical uses.
CMWC4096 Pseudo-Random Number Generator (PRNG) based on CMWC4096 as described in the paper: G. Marsaglia, Random Number Generators, Journal of Modern Applied Statistical Methods, 2003, vol. 2, no. 1, p. 2-13. Period of this PRNG is about 2^131104. Not thread-safe.
HtmlDownload Methods for downloading a web-page from the internet.
IndexDistribution A set of integers enumerated from zero and upwards that can be drawn at random according to the given probability distribution. Probabilities are assumed to sum to one. Various functions for drawing numbers are supplied with different time-complexity advantages. Thread-safe if supplied RNG's Uniform() is thread-safe.
KISS Pseudo-Random Number Generator (PRNG) based on KISS as described in the paper: G. Marsaglia, Random Number Generators, Journal of Modern Applied Statistical Methods, 2003, vol. 2, no. 1, p. 2-13. Period of this PRNG is greater than 2^124. Not thread-safe.
MWC256 Pseudo-Random Number Generator (PRNG) based on MWC256 by George Marsaglia. Period of this PRNG is about 2^8222. Not thread-safe.
MersenneTwister Pseudo-Random Number Generator (PRNG) using the Mersenne Twister algorithm by Makoto Matsumoto and Takuji Nishimura. This implementation is rewritten from their C source-code originally dated 2002/1/26. This PRNG has a very long period of 2^19937-1 (approximately 4.3 x 10^6001), and is hence known as MT19937. This implementation is the 32-bit version. Not thread-safe.
Multi Abstract class for using multiple RNGs that can be switched between. Example implementation is the Switcher-class which does the RNG-switching randomly. Thread-safe if supplied RNGs are thread-safe, and if SelectRand() is made thread-safe.
Ran2 Pseudo-Random Number Generator (PRNG) based on the Ran2 algorithm from the book: 'Numerical Recipes in C' chapter 7.1 and which is originally due to L'Ecuyer with Bays-Durham shuffle and added safeguards. Period is greater than 2 * 10^18. Not thread-safe.
Ran2.Iterator
RanInt32 Pseudo-Random Number Generator (PRNG) base-class for a generator of UInt32 integers.
RanQD Pseudo-Random Number Generator (PRNG) based on the RanQD1 (Quick and Dirty) algorithm from the book: 'Numerical Recipes in C' chapter 7.1. Not thread-safe.
RanSystem Wrapper for the .NET built-in PRNG. Not thread-safe by default.
RanUInt32 Pseudo-Random Number Generator (PRNG) base-class for a generator of UInt32 integers.
RanUInt32Array Pseudo-Random Number Generator (PRNG) base-class for a generator of UInt32 integers that uses an array.
Random
RandomDotOrg Random Number Generator (RNG) that downloads random bytes from the internet website: www.random.org. Not thread-safe. These random bytes are generated from atmospheric noise picked up by radios. Only a certain number of bits are allowed to be downloaded from this website to your IP address each day, so this RNG is used with a Fallback-PRNG.
RandomDotOrgAsync Similar to the RandomDotOrg-class, only this uses asynchronous retrieval of the random bytes, which is preferrable in time-critical applications. If bytes are not available in the downloaded buffer, then a thread is woken up to fill the buffer. In the meantime a Fallback RNG is used instead. Not thread-safe.
SumUInt32 Summing the output of multiple RNGs and taking modulo 2^32. Note that this assumes the RNGs have RandMax roughly equal to UInt32.MaxValue otherwise there will be a bias. Thread-safe if RNGs are thread-safe.
Switcher Randomly switch between different RNGs. Thread-safe if RNGs are thread-safe.
XorShift Pseudo-Random Number Generator (PRNG) based on XorShift as described in the paper: G. Marsaglia, Random Number Generators, Journal of Modern Applied Statistical Methods, 2003, vol. 2, no. 1, p. 2-13. Period of this PRNG is about 2^160. Not thread-safe.