[UK National Lottery Logo]

UK National Lottery Draw Simulation Software

The live UK lottery TV shows have been missing one obvious thing ever since they started airing in 1994, namely announcing the number of winners and prize amounts in each category within a few seconds of the final ball being drawn. It would make the TV show infinitely more exciting and obviate the need for the "lottery update" they have hours later (often after midnight when no-one's watching!).

Apart from the paranoia of typing in the wrong info live on air (or having a duff prize calculation formula that gives the wrong answers, which Camelot could cover themselves by clearing displaying that it was provisional results subject to later confirmation), I kept wondering if there was actually any technical reason why we couldn't know the prizes/winners "immediately" on the TV show.

My home desktop machine is a Dell Vostro 400 with a Q6600 quad core CPU and 4GB RAM running 64-bit Linux (usually a Fedora release) and I also have 64-bit Windows 7 Ultimate on a separate partition (primarily for games). Could I write something fast enough to do the job? And what about providing cumulative info as each ball was drawn out, so we can see the number of winners (or, indeed, losers but Camelot probably wouldn't like to show that) changing as each ball came out. Basically, can my code run in under 5 seconds at all times?

So here's the fruit of my efforts, the latest release (version 4.00) of my "draw" program on Sunday 17th October 2010. The code essentially involves either reading in or randomly generating a large number of tickets and then inputting each of the main balls in drawn order (followed by the bonus ball) and displaying an appropriate summary of the number of matches in each category. Version 4.00 includes a new -T parameter to specify the 3-match prize, pre-calculation of results during the 6-second gap before each ball is drawn and therefore a faster overall speed. Have fun playing with it and please feedback any comments or fixes to webmaster@lottery.merseyworld.com

PlatformPackageComment
32-bit LinuxBinaryUnpack with bzcat draw-4.00-i386.tar.bz2 | tar xvf -
64-bit LinuxBinarySlower than the 32-bit version (don't know why!)
32-bit WindowsBinaryRuns on 64-bit Windows as well, before you ask
32-bit Mac OS XBinaryDisk image - double click to create 'disk', double-click on 'disk', then drag draw-4.00 folder to another Finder window to unpack
Linux / Windows / Mac OS XSourceNeeds gcc/make to build (use Cygwin on Windows or Xcode on Mac OS X)

The source code and binaries are GPL 3 licensed and include cygwin1.dll from Cygwin and a small amount of code from Blender (both of which are GPL 2 licensed).

At this moment in time, I have achieved my objective of beating 5 seconds execution time for the final results table (i.e. the one displayed after the bonus ball is drawn). It's currently 0.22 seconds on quad-core 32-bit Linux and 0.38 seconds on quad-core 32-bit Windows. Sorry, no timings for Mac OS X because I'm using a (slow) virtual machine to create/run the Mac binaries.

If you're still reading at this point, here's even more info to bore you to death:

[Home]

© Richard K. Lloyd & Connect Internet Solutions Limited  2017