Linear congruential generator
A linear congruential generator is a deterministic pseudorandom number generator that repeatedly updates its state using a linear recurrence modulo a fixed modulus.
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 →
Related concepts
- pseudo-random number generatorkind of · A pseudorandom number generator is a deterministic computational process that uses an initial seed or internal state to produce a sequence with random-like statistical 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 or a configuration describing the condition of a system, entity, or computation at a particular time and potentially influencing subsequent behavior or decisions.
- generatorkind of · A generator is a language construct or computation that produces values incrementally on demand, typically suspending and resuming while preserving its state.
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.

