Archive for August, 2008

Lotto numbers PHP generator

A small search on Google showed me that most of the existent Lotto Number Generators are shareware, so I decided to write a tiny PHP script that does the basic job:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<?php
    $generated = array();
 
    while (count($generated) < 6)
    {
        $no = mt_rand(1, 49);
        if(!array_search($no, $generated))
        {
             $generated[] = $no;
        }
    }
 
    echo implode(" : ", $generated);
?>
  • Share/Bookmark

Tags: , , ,

Sunday, August 10th, 2008 PHP No Comments