Is Linear Congruential Generator a Reliable Random Number Generator?

In summary, a linear congruential generator (LCG) is a type of pseudo-random number generator commonly used in computer programs for simulations, games, and statistical analysis. It works by using a linear equation and has advantages such as simplicity and fast computational speed, as well as limitations such as predictability and dependence on chosen values. Alternatives to LCGs include other types of pseudo-random number generators like Mersenne Twister, XORshift, and Blum Blum Shub.
  • #1
mebigp
7
0
Linear congruential generator x_n (equivalence) k x_{n-1} (mod 100)where k is some fixed

positive integer. Is this a good random number generator (that generates from 0 to 99). for

which k is this particularly bad and are are there any k for which this is better than other

k? How many such better k are there ? You can not determine the initial seed, x_0.

I think any k that is 10,20,30.. gives a 0.
 
Physics news on Phys.org
  • #2
Select a number coprime with 100.
 

What is a linear congruential generator (LCG)?

A linear congruential generator is a type of pseudo-random number generator that uses a linear equation to generate a sequence of numbers that appear to be random. It is commonly used in computer programs to generate random numbers for simulations, games, and statistical analysis.

How does an LCG work?

An LCG uses the formula Xn+1 = (aXn + c) mod m, where Xn is the current number in the sequence, a and c are constants, and m is the modulus. The modulus determines the period of the sequence, which is the number of unique numbers that can be generated before the sequence repeats itself.

What are the advantages of using an LCG?

LCGs are relatively simple to implement and have a fast computational speed, making them efficient for use in computer programs. They also have a long period, meaning that it takes a large number of iterations before the sequence repeats itself, making them suitable for use in simulations and other applications where a large number of random numbers are needed.

What are the limitations of an LCG?

One major limitation of an LCG is that the generated sequence is not truly random, as it follows a predictable pattern. This can lead to patterns and biases in the generated numbers, and may not be suitable for use in cryptography or other applications where true randomness is necessary.

Additionally, the quality of the generated numbers depends on the chosen values for the constants a, c, and m. If these values are not carefully selected, the generated numbers may not appear random and may have a shorter period.

Are there any alternatives to using an LCG?

Yes, there are many other types of pseudo-random number generators that can be used, such as Mersenne Twister, XORshift, and Blum Blum Shub. These generators use different algorithms and may have different properties, such as a longer period or better randomness, making them more suitable for certain applications.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
15
Views
1K
  • Programming and Computer Science
Replies
1
Views
632
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
909
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
3K
  • Programming and Computer Science
Replies
21
Views
3K
  • Programming and Computer Science
Replies
22
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
  • Atomic and Condensed Matter
Replies
3
Views
859
Back
Top