a (good) 32-bit LCG can be used to obtain about a thousand random numbers; a 64-bit LCG is good for about 221 random samples (a little over two million), etc. For this reason, in practice LCGs are not suitable for large-scale Monte Carlo simulations. Sample code Python code The following is an implementation of an LCG in Python, in the form of a generator: from collections.abc import Generator def lcg(modulus: int, a: int, c: int, seed: int) -> Generator[int, None, None]: """Linear congruential generator.""" while True: seed = (a * seed + c) % modulus yield seed Free Pascal Free Pascal uses a Mersenne Twister as its default pseudo random number generator whereas Delphi uses a LCG. Here is a Delphi compatible example in Free Pascal based on the information in the table above. Given the same RandSeed value it generates the same sequence of random numbers as Delphi. unit lcg_random; {$ifdef fpc}{$mode delphi}{$endif} interface function LCGRandom: extended; overload; inline; function LCGRandom(const range:longint): longint; overload; inline; implementation function IM: cardinal; inline; begin RandSeed := RandSeed * 134775813 + 1; Result := RandSeed; end; function LCGRandom: extended; overload; inline; begin Result := IM * 2.32830643653870e-10; end; function LCGRandom(const range: longint): longint; overload; inline; begin Result := IM * range shr 32; end; Like all pseudorandom number generators, a LCG needs to store state and alter it each time it generates a new number. Multiple threads may access this state simultaneously causing a race condition. Implementations should use different state each with unique initialization for different threads to avoid equal sequences of random numbers on simultaneously executing threads. LCG derivatives There are several generators which are linear congruential generators in a different form, and thus the techniques used to analyze LCGs can be applied to them. One method of producing a longer period is to sum the outputs of several LCGs of different periods having a large least common multiple; the Wichmann–Hill generator is an example of this form. (We would prefer them to be completely coprime, but a prime modulus implies an even period, so there must be a common factor of 2, at least.) This can be shown to be equivalent to a single LCG with a modulus equal to the product of the component LCG moduli. Marsaglia's add-with-carry and subtract-with-borrow PRNGs with a word size of b=2w and lags r and s (r > s) are equivalent to LCGs