Dear All,
I would like to start a little project for my own leisure time on the lottery gaming programming. Can someone know where to find some programming examples for lotto concerning 6 numbers from 1 to 40 and how it works in reality. Is there some documentations on lotto programming?
Thanks and Best Regards
Dilbert137
Lotto programming
Moderator: General Moderators
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
Re: Lotto programming
id imagine they have numbers stored in a db and they draw them out randomly
-
shauns2007
- Forum Commoner
- Posts: 27
- Joined: Wed Feb 02, 2011 11:34 am
Re: Lotto programming
I don't think anybody would know exactly how the lottery draws the numbers besides the big guys at the lottery them selves
What exactly do you want to do? I created a little lotto app the other day by adding all the numbers to an array then using array_rand to extract 6 random numbers. Is this something you looking for?
Re: Lotto programming
Sounds like that would work too shauns
-
shauns2007
- Forum Commoner
- Posts: 27
- Joined: Wed Feb 02, 2011 11:34 am
Re: Lotto programming
Here is the code
Code: Select all
$lotto_numbers = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9,
10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16,
17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => 21, 22 => 22, 23 => 23,
24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30,
31 => 31, 32 => 32, 33 => 33, 34 => 34, 35 => 35, 36 => 36, 37 => 37,
38 => 38, 39 => 39, 40 => 40, 41 => 41, 42 => 42, 43 => 43, 44 => 44,
45 => 45, 46 => 46, 47 => 47, 48 => 48, 49 => 49);
$random1 = array_rand($lotto_numbers,6);
sort($random1);
$string = "Your lucky quick pick numbers are as follows: ";
print $string;
print $random1[0]. ", ";
print $random1[1]. ", ";
print $random1[2]. ", ";
print $random1[3]. ", ";
print $random1[4]. " and ";
print $random1[5];