Linear Congruential Generator 1,4,9

In summary, a Linear Congruential Generator (LCG) is a type of pseudorandom number generator that uses a linear equation to produce a sequence of numbers. It is commonly used in computer programs for generating random numbers and has the advantages of being simple to implement, requiring minimal memory, and producing a large amount of numbers quickly. However, LCGs also have limitations such as a limited period and known statistical weaknesses. Some alternatives to LCGs include other types of pseudorandom number generators, true random number generators, and cryptographic algorithms.
  • #1
mebigp
7
0

Homework Statement


X=(aX + b) mod 65536
Output is 1,4,9, ?

Can anyone give me a hint as to what a and b are


Homework Equations





The Attempt at a Solution


1=(aX + b) mod 65536
4=(a1 + b) mod 65536
9=(a4 + b) mod 65536

The values I have tried get me from 4 to 7 not 9
 
Physics news on Phys.org
  • #2
By sub 5=3a mod 65536 but I am stuck here
 

FAQ: Linear Congruential Generator 1,4,9

What is a Linear Congruential Generator?

A Linear Congruential Generator (LCG) is a type of pseudorandom number generator that produces a sequence of numbers based on a linear equation. It is commonly used in computer programs for generating random numbers.

How does a Linear Congruential Generator work?

A Linear Congruential Generator uses a mathematical formula to generate a sequence of numbers. The formula involves multiplying the previous number in the sequence by a constant, adding another constant, and then taking the remainder after dividing by a third constant. This remainder becomes the next number in the sequence.

What are the advantages of using a Linear Congruential Generator?

LCGs are relatively simple to implement, require minimal memory, and can produce a large amount of numbers quickly. They are also considered to be statistically "good enough" for many applications.

What are the limitations of a Linear Congruential Generator?

LCGs have a limited period, meaning that the sequence of numbers will eventually repeat. They also have some known statistical weaknesses, such as producing numbers that are not truly random and having correlations between numbers in the sequence.

What are some alternatives to using a Linear Congruential Generator?

Some alternatives to LCGs include other types of pseudorandom number generators, such as Mersenne Twister or XORshift. True random number generators, which use physical processes to generate random numbers, are also an option. Additionally, cryptographic algorithms can be used for generating random numbers with high security.

Similar threads

Back
Top