How JZMaths prize draws work
Since this is our second prize draw, I thought it made sense to settle on a standard method!
The aim is simple: choose a winner fairly, using a future random event outside my control, with a calculation that anyone can check. I previously used this method for the Logic Course Easter Egg Hunt in September 2026.
Each draw’s announcement will give the prize, eligibility rules, entry deadline, the Lotto draw to be used, and the winner’s deadline for claiming the prize.
1. Assigning entry numbers
Once entries have closed, I finalise the list of eligible entrants.
Let be the number of entrants. Each entrant receives a unique number from to , which I email to them before the specified Lotto draw takes place.
The entrant list, entry numbers and chosen Lotto draw are then fixed.
2. Turning the Lotto results into a string
The random input comes from the results of the future official National Lottery Lotto draw named in the announcement.
I use the six main numbers from each of its two rounds, excluding the Bonus Balls. Within each round, the numbers are written in ascending order.
The numbers are separated by hyphens, with a vertical bar between Round 1 and Round 2. There are no spaces or leading zeros.
For example:
- Round 1: 11, 28, 41, 48, 57, 59
- Round 2: 7, 8, 20, 21, 22, 52
These produce the following exact string:
11-28-41-48-57-59|7-8-20-21-22-52
If the named Lotto draw does not take place, I use the next Lotto draw that does.
3. Calculating the winning number
I calculate the SHA-256 hash of that exact string, encoded as UTF-8, with no extra characters or line break.
For the example above, the hash is:
01cded0558268e5e2e4bcea75b40826233cd88402928b8e014116c7b1332739e
I then interpret those 64 hexadecimal digits as a single non-negative integer, . In ordinary decimal notation, this gives the following 75-digit number:
816152354830100611821330557368477464889221606955577130964219875915136660382
The winning entry number is the remainder when is divided by .
Every step after the Lotto results is deterministic: the same results always produce the same winning number. I publish the input string, hash, value of and winning entry number so that anyone can check the calculation.
For the very mathematically curious
Does this give every entrant exactly the same probability of winning?
Not necessarily! SHA-256 is designed to produce outputs that behave like uniformly distributed values, but this is not a proof that the possible Lotto results give perfectly equal winning probabilities. Taking a remainder can also introduce a small bias, even if the integer being divided is uniformly distributed.
For this prize draw, I’m happy with this practical approach. The important features are that the random input is outside my control, the rules are fixed beforehand, and the calculation is reproducible. And the differences in probability are negligible!
If you fancy investigating just how close to equal the probabilities are: over to you! 😂
4. Claiming the prize
I contact the winner using the email address on their JZMaths account. They must reply by the deadline given in the draw’s announcement.
If they do not reply in time, they forfeit the prize. It then passes to the entrant with the next entry number, wrapping from back to .
Each subsequent entrant has until 23:59 UK time on the day after I contact them to reply, unless the announcement says otherwise. This continues in entry-number order until someone claims the prize or every entrant has had an opportunity to do so.
If the winner is under 18, I’ll need a parent or guardian’s consent before arranging or sending the prize.