← Tuesday, September 29, 2026Languages & toolsDeep dive

TimeLord constructs Python PRNG seeds for chosen runs of heads

github.com 7 min read Editor score 7/10

The demonstration chooses an ordinary Python integer seed after specifying the desired output, producing runs of up to 1,000 heads without modifying the generator. It illustrates how adversarial seed selection can make a striking pseudorandom sequence say little about chance.

What
TimeLord constructs an ordinary Python integer seed that makes CPython's pseudorandom generator produce a chosen run of heads.
How
It constrains MT19937 output bits and solves for a compatible state; the result is reproducible, but the seed was selected after the desired output.
Why it matters
Engineers assessing unlikely random outcomes must account for whether the seed was independently chosen or selected after the fact.
sets state output word two bits result integer seed MT19937 getrandbits(2) randrange(2) HEADS
A seed drives CPython's random-number path to produce coin-toss outputs. Sketched from the article's own text.

Discussion

Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.

Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.