liveBook · Manning

Linear congruential generator

Also called LCG

A linear congruential generator is a deterministic pseudorandom number generator that updates its state using a linear recurrence modulo a fixed integer.

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 →

Also covered in

Related concepts

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.