liveBook · Manning

Pseudo-random number generator

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.

How 10 Manning books explain it

Hacking Cryptography

A pseudorandom number generator uses a deterministic algorithm and an initial seed to produce a sequence of values that appears random.

How it is used
Distinguishes fast deterministic generation from cryptographic randomness and motivates secure seeding and generator selection.
How deep it goes
Implements an LCG, validates its output, and works through recovery of its modulus, multiplier, increment, and state.
Examples
Uses C++ minstd_rand and a Go LCG with seed 42, then clones an LCG from generated outputs.
What you can do after
Evaluate/understand why deterministic PRNG output can be reproduced, cloned, and unsuitable for cryptographic use.

Read how Hacking Cryptography explains pseudo-random number generator →

Real-World Cryptography

A pseudorandom number generator is a deterministic algorithm that expands a secret seed into a sequence of computationally generated values designed to resemble random values.

How it is used
Supports fast generation of cryptographic randomness after operating systems collect and mix slower entropy sources.
How deep it goes
Explains seeds, deterministic output, indistinguishability, state protection, and secrecy properties without implementation-level construction details.
Examples
Uses TCP connection values, getrandom, BCryptGenRandom, /dev/urandom, C code, PHP code, and predictable-seed failures.
What you can do after
Operate/configure randomness safely by choosing OS-backed interfaces, waiting for adequate seeding, and avoiding predictable or noncryptographic generators.

Read how Real-World Cryptography explains pseudo-random number generator →

Learn Haskell by Example

A random value generator is a computation that produces random or pseudo-random values, often with controlled variation in size or complexity.

How it is used
Supplies varied inputs for property tests that search for implementation errors.
How deep it goes
Explains explicit state threading with a linear congruential generator, then defers general generation to System.Random and QuickCheck.
Examples
Demonstrates a state-threaded integer list, sorting tests, and an alphabet-rotation property falsified by invalid generated inputs.
What you can do after
Apply it via QuickCheck or custom generators to provide randomized, constrained inputs for pure-function properties.

Read how Learn Haskell by Example explains pseudo-random number generator →

Deep Learning with R, Third Edition

A pseudo-random number generation operation deterministically produces values that appear random from an algorithmic seed or key.

How it is used
Controls reproducible random operations in stateful R code and stateless JAX programs.
How deep it goes
Explains global state, explicit keys, reproducibility, and key splitting through runnable implementation examples.
Examples
Uses R uniform-noise generation, JAX normal sampling, repeated keys, and split keys.
What you can do after
Apply explicit seeds and JAX keys to reproduce results and generate fresh random values predictably.

Read how Deep Learning with R, Third Edition explains pseudo-random number generator →

Functional Programming in Scala, Second Edition

Pseudo-random number generation is the deterministic production of values that approximate randomness from an initial seed.

How it is used
Uses random number generation as a compact setting for learning how to make stateful APIs purely functional.
How deep it goes
Explains mutation, reproducibility, explicit state transitions, and compositional Rand abstractions, while deferring broader stateful effects.
Examples
Uses scala.util.Random, die rolling, SimpleRNG(42), explicit seed threading, and reproducible generated integers.
What you can do after
Build it from scratch as a pure seed-to-value-and-state function and compose it with Rand operations.

Read how Functional Programming in Scala, Second Edition explains pseudo-random number generator →

Deep Learning with Python, Third Edition

How it is used
Uses explicit random keys to produce values in JAX's stateless execution model.
How deep it goes
Explains key creation, repeatable calls, and deterministic splitting without detailing the generator algorithm.
Examples
Demonstrates repeated random.normal calls with one key and a new output after splitting that key.
What you can do after
Apply it via jax.random.key and jax.random.split to produce repeatable random tensors without hidden global state.

Read how Deep Learning with Python, Third Edition explains pseudo-random number generator →

Optimization Algorithms: AI techniques for design, planning, and control problems

A deterministically generated number sequence that exhibits statistical properties resembling randomness.

How it is used
Supports inexpensive, diverse initial-population sampling for exploration in population-based metaheuristic algorithms.
How deep it goes
Defines determinism and sampling trade-offs, then demonstrates seeded NumPy generation without deriving generator internals.
Examples
Uses seeded NumPy sampling of 200 values and compares pseudo-random, quasi-random, Sobol, Latin hypercube, and other sampling plots.
What you can do after
Apply it via NumPy to generate reproducible candidate populations for metaheuristic search.

Read how Optimization Algorithms: AI techniques for design, planning, and control problems explains pseudo-random number generator →

Deep Learning with JAX

A deterministic algorithm that produces numbers that appear random from an internal state or seed.

How it is used
Supports reproducible stochastic operations such as initialization, augmentation, sampling, dropout, and simulation.
How deep it goes
Defines seeds, internal state, deterministic sequences, periods, and JAX key discipline.
Examples
Uses neural-network weights, image noise, rotations, random data splits, sampling, and parameter searches as applications.
What you can do after
Apply it via JAX keys to initialize parameters and generate controlled random values without hidden generator state.

Read how Deep Learning with JAX explains pseudo-random number generator →

Clojure: The Essential Reference

A pseudorandom number generator is a deterministic algorithm that produces number sequences with statistical properties resembling random sequences.

How it is used
Supports practical random selection such as percentage-based A/B feature rollouts.
How deep it goes
Defines contracts, ranges, types, and outputs, then sketches linear congruential generation and repeating periods.
Examples
Demonstrates feature rollouts, sampled negative integers, random survey progress, image noise, and visible generator patterns.
What you can do after
Apply rand and rand-int to generate bounded doubles or integers for practical randomized behavior.

Read how Clojure: The Essential Reference explains pseudo-random number generator →

Learn Go with Pocket-Sized Projects

A random number generator is a procedure or system that produces values intended to follow a specified randomness model.

How it is used
Selects a random word from a corpus for a terminal word game.
How deep it goes
Explains bounded generation, algorithmic sources, package tradeoffs, and seeding, but does not detail generator algorithms.
Examples
Demonstrates selecting a corpus word with rand.Intn and testing membership across multilingual sample words.
What you can do after
Build random corpus selection with Go's math/rand and test its result without assuming a specific output.

Read how Learn Go with Pocket-Sized Projects explains pseudo-random number 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.