====== Chess - Programming - PRNG (Pseudo Random Number Generator) ====== **Pseudo Random Number Generator(PRNG)** refers to an algorithm that uses mathematical formulas to produce sequences of random numbers. * PRNGs generate a sequence of numbers approximating the properties of random numbers. * It is not possible to generate truly random numbers from deterministic thing like computers so PRNG is a technique developed to generate random numbers using a computer. A PRNG starts from an arbitrary starting state using a seed state. * Many numbers are generated in a short time and can also be reproduced later, if the starting point in the sequence is known. * Hence, the numbers are deterministic and efficient. Widely used PRNG algorithms include: Lagged Fibonacci generators, linear feedback shift registers, Blum Blum Shub. ---- ===== Characteristics of PRNG ===== * Efficient: * PRNG can produce many numbers in a short time and is advantageous for applications that need many numbers. * Deterministic: * A given sequence of numbers can be reproduced at a later date if the starting point in the sequence is known. * Determinism is handy if you need to replay the same sequence of numbers again at a later stage. * Periodic: * PRNGs are periodic, which means that the sequence will eventually repeat itself. * While periodicity is hardly ever a desirable characteristic, modern PRNGs have a period that is so long that it can be ignored for most practical purposes ---- ===== Applications of PRNG ===== PRNGs are suitable for applications where many random numbers are required and where it is useful that the same sequence can be replayed easily. * Popular examples of such applications are simulation and modeling applications. * PRNGs are not suitable for applications where it is important that the numbers are really unpredictable, such as data encryption and gambling. ---- [[Chess:Programming:PRNG (Pseudo Random Number Generator):A Pseudo Random Number Generator using srand()|A Pseudo Random Number Generator using srand()]] [[Chess:Programming:PRNG (Pseudo Random Number Generator):Linear Congruential Generator|Linear Congruential Generator]] ---- ===== References ===== https://en.wikipedia.org/wiki/Linear_congruential_generator https://www.pcg-random.org/index.html