Anonymous user
Random number generator (included): Difference between revisions
Random number generator (included) (view source)
Revision as of 17:43, 30 January 2010
, 14 years agono edit summary
m (→{{header|C}}) |
mNo edit summary |
||
Line 8:
The main types of pseudo-random number generator, ([[wp:PRNG|PRNG]]), that are in use are the Linear Congruential Generator, ([[wp:Linear congruential generator|LCG]]), and the Generalized Feedback Shift Register, ([[wp:Generalised_feedback_shift_register#Non-binary_Galois_LFSR|GFSR]]), (of which the [[wp:Mersenne twister|Mersenne twister]] generator is a subclass). The last main type is where the output of one of the previous ones (typically a Mersenne twister) is fed through a [[wp:Cryptographic hash function|cryptographic hash function]] to maximize unpredictability of individual bits.
LCGs have the advantage of not requiring much state and being very fast to calculate, but produce random numbers with spectral problems. This makes them unsuitable for both [[wp:Monte Carlo method|Monte Carlo simulation]] and [[wp:Cryptography|cryptography]]. By contrast, GFSRs (of which the Mersenne Twister is
=={{header|C}}==
|