-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Psuedo random number generators #5
Comments
purescript/purescript-random |
JuliaRandom/RandomNumbers.jlPCG FamilyPermuted Congruential Generators (PCGs) are a family of RNGs which uses a linear congruential generator as the state-transition function, and uses permutation functions on tuples to produce output that is much more random than the RNG's internal state. Each PCG generator is available in four variants, based on how it applies the additive constant for its underlying LCG; the variations are:
PCG Method Type:
Mersenne TwistersThe Mersenne Twister is so far the most widely used PRNG. Mersenne Twisters are taken as default random number generators of a great many of software systems, including the Julia language until the current 1.0 version. The most commonly used version of Mersenne Twisters is MT19937, which has a very long period of 2^19937−1 and passes numerous tests including the Diehard tests. However, it also has many flaws by today's standards. For the large period, MT19937 has to use a 2.5 KiB state buffer, which place a load on the memory caches. More severely, it cannot pass all the TestU01 statistical tests2, and the speed is not so fast. So it is not recommended in most situations. Random123 FamilyRandom123 is a library of "counter-based" random number generators (CBRNGs), developed by D.E.Shaw Research1. Counter-based means the RNGs in this family can produce the Nth number by applying a stateless mixing function to the counter N, instead of the conventional approach of using N iterations of a stateful transformation. The current version of Random123 in this package is 1.09, and there are four kinds of RNGs: Threefry, Philox, AESNI, ARS. Threefry is a non-cryptographic adaptation of the Threefish block cipher from the Skein Hash Function. Philox uses a Feistel network and integer multiplication. AESNI uses the Advanced Encryption Standard (AES) New Instruction, available on certain modern x86 processors (some models of Intel Westmere and Sandy Bridge, and AMD Interlagos, as of 2011). AESNI CBRNGs can operate on UInt128 type. ARS (Advanced Randomization System) is a non-cryptographic simplification of AESNI. Xorshift FamilyXorshift family is a class of PRNGs based on linear transformation that takes the exclusive or of a number with a bit-shifted version of itself. They are extremely fast on mordern computer architectures, and are very suitable for non-cryptographically-secure use. The suffix -Star and -Plus in the RNG names denote to two classes of improved RNGs23, which make it to pass Big Crush in TestU01. -Star RNGs are obtained by scrambling the output of a normal Xorshift generator with a 64-bit invertible multiplier, while -Plus RNGs return the sum of two consecutive output of a Xorshift generator. They have a period of 2^64, but not recommended because 64 bits of state are not enough for any serious purpose. They have a period of 2^128. Xorshift128Plus is presently used in the JavaScript engines of Chrome, Firefox and Safari. They have a long period of 2^1024, and takes some more space for storing the state. If you are running large-scale parallel simulations, it's a good choice to use Xorshift1024Star. The successor to Xorshift128 series. They make use of a carefully handcrafted shift/rotate-based linear transformation, resulting in a significant improvement in speed and in statistical quality. Therefore, Xoroshiro128Plus is the current best suggestion for replacing other low-quality generators. |
cmcqueen/simplerandom
Most algorithms were obtained from two newsgroup posts by George Marsaglia (mars1) (mars2). However, some modifications have been made. From (rose1), it seems that the SHR3 algorithm defined in (mars1) is flawed and should not be used. It doesn't actually have a period of 232-1 as expected, but has 64 different cycles, some with very short periods. The SHR3 in the 2003 post is very similar, but with two shift values swapped. It has a period of 232-1 as expected. We still find KISS from (mars1) useful mainly because it uses 32-bit calculations for MWC, which can be more suitable for small embedded systems. So we define KISS that uses a MWC based on (mars1), but the Cong and SHR3 from (mars2). From Pierre L'Ecuyer (lecuyer1) (lecuyer2), the Combined LFSR (Tausworthe) LFSR113 algorithm (lecuyer3) and LFSR88 (aka Taus88) have been implemented. Random Number Generators ProvidedThe following pseudo-random number generators are provided:
|
lemire/SIMDxorshiftPlease check it out. |
leesper/go_rngSupported Distributions and Functionalities
Usage |
Pseudo random numbers can be generated quickly, when you need a lot of them. May be useful for Procedural generation or Monte Carlo simulation.
haskell/random
High level
RandomGen class
Random class
StdGen class
The are also global variants of the functions.
The text was updated successfully, but these errors were encountered: