Linear congruential generator
A linear congruential generator is a deterministic pseudorandom number generator that updates its state using a linear recurrence modulo a fixed integer.
Hacking Cryptography
A deterministic pseudorandom number generator that repeatedly applies a linear congruence to produce values in a sequence.
- How it is used
- Uses LCGs to practice implementing PRNGs and exploiting predictable state.
- How deep it goes
- Derives and implements recovery of increment, multiplier, and modulus, then stops short of treating LCGs as secure generators.
- Examples
- Demonstrates C++ minstd_rand compatibility, a Go implementation, parameter recovery, and a cloned generator matching 100 outputs.
- What you can do after
- Diagnose weak PRNG designs by implementing an LCG, recovering its parameters, and predicting its subsequent outputs.
Read how Hacking Cryptography explains linear congruential generator →
Clojure: The Essential Reference
A linear congruential generator is a pseudorandom number algorithm that repeatedly applies a linear recurrence involving multiplication, addition or seeding, and modular reduction.
- How it is used
- Supports ordinary probabilistic choices and random values in Clojure applications.
- How deep it goes
- Explains seeding, multiplication, modular reduction, repetition, and statistical weaknesses without deriving the full recurrence.
- Examples
- Uses `rand`, `rand-int`, probabilistic questionnaire branching, and visualized random bits.
- What you can do after
- Apply Clojure's `rand` and `rand-int` for practical random choices while recognizing when LCG quality is insufficient.
Read how Clojure: The Essential Reference explains linear congruential generator →
Also covered in
Related concepts
- pseudo-random number generatorkind of · A pseudorandom number generator is a deterministic algorithm that uses an initial seed or internal state to produce a sequence of values with random-like properties.
- Math.randomused by · Math.random is a function or method that returns a pseudorandom floating-point number greater than or equal to zero and less than one.
- cryptographycontrasts with · Cryptography is the study and application of mathematical techniques for protecting information and communications through confidentiality, integrity, authentication, and related security properties.
- stateused by · State is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.
- generatorkind of · A generator is a language construct or computation that produces values incrementally on demand, typically suspending and resuming while preserving its state.
Questions about linear congruential generator
What is linear congruential generator?
A linear congruential generator is a deterministic pseudorandom number generator that updates its state using a linear recurrence modulo a fixed integer.
Which Manning books explain linear congruential generator?
Hacking Cryptography and Clojure: The Essential Reference.
What is the difference between linear congruential generator and cryptography?
A linear congruential generator is a deterministic pseudorandom number generator that updates its state using a linear recurrence modulo a fixed integer. Cryptography is the study and application of mathematical techniques for protecting information and communications through confidentiality, integrity, authentication, and related security properties.
What kinds of linear congruential generator are there?
Kinds of linear congruential generator include RANDU.
What is linear congruential generator a kind of?
Linear congruential generator is a kind of pseudo-random number generator. A pseudorandom number generator is a deterministic algorithm that uses an initial seed or internal state to produce a sequence of values with random-like properties.
What is linear congruential generator also called?
Linear congruential generator is also called LCG.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

