This is the sixteenth post in the LocalPapa Notes dev-log series.
Today's subject is one of the site's lightest tools — the Lottery Predictor. Short build time, minimal code, but a design question worth documenting: is the "prediction" in this tool genuine?
Starting with math: lotteries cannot be predicted
Let's say this clearly. Taiwan's Big Lotto picks 6 from 49 numbers; every draw is an independent random event. If last week's draw was 07, 14, 22, 31, 38, 42 — the probability of any particular number appearing next draw is identical to every other possible outcome. Historical results carry zero information about future draws.
This is probability theory fundamentals, not opinion. Any tool claiming to "use historical data to identify hot numbers for the next draw" is either deliberately misleading or not thinking clearly about what it's doing.
So if lottery results can't be predicted, what does our "Lottery Predictor" actually do?
What it actually does: deterministic entertainment
It uses time as a seed and generates numbers with a deterministic algorithm.
``javascript function getSeed() { const blockSize = 30 * 60 * 1000; // 30 minutes return Math.floor(Date.now() / blockSize); } ``
Take the current timestamp, divide by the number of milliseconds in 30 minutes, floor the result — within any given 30-minute window, this value is constant. That's the seed.
``javascript function seededRandom(seed) { const m = 0x80000000; // 2^31 const a = 1103515245; // glibc standard LCG multiplier const c = 12345; let state = seed; return function () { state = (a * state + c) % m; return state / (m - 1); } } ``
This is a Linear Congruential Generator (LCG) — the a, c, m values are glibc's standard parameters, in use for decades. It's pseudo-random: same seed always produces the same sequence. Change the seed and the sequence changes.
Feed that into 6 unique numbers from 1–49 (a Set handles deduplication, sorted ascending) and you have "this 30-minute window's lucky numbers."
Within those 30 minutes, no matter how many times you click "Predict," the numbers are the same. The window closes, seed increments, a new set of numbers appears.
Why LCG over Math.random()
Math.random() gives a different value on every call — genuinely (or near-genuinely) random. Using it, every button press gives different numbers; the user has no "today's lucky numbers" to look up or share, and no "current" number to share with a friend.
LCG's determinism is the feature:
- Same device, same time window, same numbers — you can screenshot and share; your friend sees the same set.
- Cross-device consistency — A and B open the tool in the same 30-minute window and get the same numbers, which feels coherent.
- The countdown has meaning — users know exactly when the numbers change and can "look forward" to the next draw.
Wrapping an unpredictable outcome in a deterministic time function to create "a rhythmic entertainment experience" is a design intent, not a technical compromise.
Rolling ball animations: communication design
Six numbered balls appear in sequence, each with a "rolling" animation (CSS class toggle plus staggered setTimeout at 200ms per ball). This isn't decoration — it's communication design:
- It gives users the ritual of "watching a draw," not just reading six digits.
- Staggered appearance makes each number noticed individually, not swept past.
- The button disables during animation to prevent re-triggering.
The perceived quality of an entertainment tool is largely determined by its procedural feel, not just the underlying numbers.
Two faces of the word "prediction"
This tool is called a Lottery Predictor. From an SEO perspective, "lottery prediction" (樂透預測) is a high-volume search term — many people genuinely search for this and want a tool for it. If the tool were named "Lottery Number Generator," far fewer people would find it.
But for the user, the page must clarify immediately on arrival. The disclaimer:
For entertainment purposes only. Numbers are generated deterministically using time-block algorithms every 30 minutes.
This sentence does three things:
- "Entertainment purposes only" — not real prediction.
- "Generated deterministically using time-block algorithms every 30 minutes" — tells you the mechanism, no mystification.
- Explains it's deterministic — so you know clicking again in the same window won't change the result.
Using "prediction" in the title is for discoverability; explaining it's not real prediction immediately on the page is for honesty. This is honest marketing: attract the right audience, then immediately calibrate expectations correctly.
A contrast with the divination services
If you've read this series in order, there's an interesting parallel to note:
- Zi Wei Dou Shu, Yi Zhang Jing: complex algorithms, traditional scholarly basis, honestly labelled "interpretive content, not prediction."
- Lottery Predictor: trivially simple algorithm, no basis whatsoever, honestly labelled "entertainment, deterministically generated."
Both say "not a prediction," but from completely different starting points. The divination services say "I have a traditional system with interpretive value, but don't treat it as objective prophecy." The lottery tool says "I have no predictive capacity at all — this is a nicely packaged time function."
The boundary of honesty differs; the requirement for honesty is the same.
What we learned
- Don't package mathematically impossible things as possible. Lottery draws are independent random events. The tool can't violate that — it works around it: offering "deterministic entertainment" instead of "statistical prediction."
- Determinism sometimes beats randomness for user experience. Fixed numbers per 30-minute window, cross-device consistency, a meaningful countdown — all advantages of determinism.
- The ancient LCG parameters exist for good reason. The glibc
a/c/m values have good distribution properties and a long cycle — entirely sufficient for entertainment use, no need to research alternatives.
- Attracting an audience and honest disclosure can coexist. Title uses the high-volume search term; page immediately clarifies the mechanism. Not deception — layered communication.
- Rolling ball animation is part of the tool, not sugar-coating. Procedural feel turns "output" into "experience."
The same question, applied to honesty
Earlier tools asked "can this be done in the browser." This one asks: can you honestly package a tool that does something mathematically impossible, make it useful and fun, and not deceive the user?
You can. The key: know what you're actually doing (deterministic time function), say so clearly (the disclaimer explains the mechanism directly), then make the experience itself worth having (rhythm, countdown, rolling animations).
An honest entertainment tool is more worth building than a dishonest "prediction tool."
Series continues. Next in the divination arc — how tarot uses 22 major arcana individually plus "suit × rank" combinations for the 56 minor arcana to cover all 78 cards with minimal data, running the same deterministic local computation, carrying the same honest "interpretive tool" label. Want to follow the series? Bookmark LocalPapa Notes.