I have been reading on https://www.pcg-random.org/pdf/hmc-cs-2014-0905.pdf about how to do some random number generation. It involves LCGs. Exploring on Wikipedia I found out about the following two papers that give reasonable constants for those LCGs:



LCGs are essentially defined by the following relation:

X(n+1) = (a * X(n) + c) mod m, n >= 0.

There are 4 constants involved: m the modulus, a the multiplier, X(0) the starting value or seed and c the increment. The problem is that the LCG constants tables in the papers only give combinations of good m and a. There is no mention about the X(0) and c constants that you need to choose.

Any help in understanding how to choose X(0) and c or mabe me not understanding the papers is much appreciated.


1 Answer 1


I have emailed Pierre Lecuyer as well to ask about this problem and he replied exactly with the following points:

  1. m should be a prime number and c=0. The choice of a is crucial and not easy. See the papers. X(0) can be any number from 1 to m-1.
  2. However, LCGs like that are no longer recommended; they are not suitable for modern computers because they have too much structure and their period is too small.

He also gave me 3 references from his papers/books where I may find what I need, again exactly as he replied:

See chapter 3 of this draft book:


Also here:




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.