liveBook · Manning

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.

How 2 Manning books explain it

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

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.