Lotto Number Generator

Recently I created several versions of lotto number generators both in Java programs, JApplets and PHP functions. The easiest by far was the PHP which took just several lines of code (See below).

Why not get a lotto quickpick?

The lotto number generator below was designed to seed the numbers in a particular way so the numbers wouldn't clump together. This arose after getting quickpicks in a newsagents and being disappointed with the resulting numbers. That's not to say the lotto wont come out with mad numbers like 1,2,3,4,5,6 as while that's still technically possible, it's also very unlikely.

In this code I have the numbers seeded so it'll pick one number between the range of 1-8, one from 9-15 and so on for the remaining numbers. You could also use other PHP functions such as srand to help further seed the numbers.


Lotto Number Generator for Irish Lottery (1-45 numbers)

6 , 12 , 18 , 24 , 34 , 44

Note: To get a different set of numbers just refresh your internet browser by hitting F5 on your keyboard.


PHP Code:



<?php

echo rand(1, 8)." , ";
echo rand(9, 15)." , ";
echo rand(16, 23)." , ";
echo rand(24, 31)." , ";
echo rand(32, 38)." , ";
echo rand(39, 45);

?>