The Maths You Actually NeedLesson 74 of 76

Module 8 · Numbers inside a machine

Random numbers that are not, and what a seed does and does not fix

In this lesson

  • 9 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 8 of 10 in this chapter

This chapter’s goalPredict from the bit layout of float32, fp16 and bf16 which computation will overflow, underflow or lose its digits, explain why a long sum drifts and how to fix it, quantise a weight to int8 by hand and say what an outlier does to the rest of the tensor, derive the initialisation scale that keeps variance constant through a layer, and diagnose a NaN in training back to the operation that produced it.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

Determinism wearing a disguise

A computer cannot produce a random number. What it produces is a pseudo-random sequence: a fixed recipe that turns one state into the next, chosen so that the output passes every statistical test for randomness while being entirely determined by where it started. The starting state is the seed. Same seed, same recipe, same sequence, forever.

The simplest recipe, a linear congruential generator, is one line: state = (a × state + c) mod m. Modern generators, the Mersenne Twister behind older NumPy and Python’s random, and the PCG64 behind np.random.default_rng, are more elaborate but no less deterministic. Their period, the number of outputs before the sequence repeats, is around 2^19937 for the Twister and 2^128 for PCG64. Neither will repeat in your lifetime. But a sequence that never repeats is not the same as one that cannot be predicted; if the seed is known, every number is known.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Stuck on something?Ask Funke, your AI tutor

How to cite: Addaly (2026) ‘Random numbers that are not, and what a seed does and does not fix’, in The Maths You Actually Need. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/maths-you-need/random-numbers-and-seeds (Accessed: 29 November 2026).