Anyone know some code and/or function to implement math systems on lottery and/or number extractions ?
E. g. National lottery that extract 6 numbers ... there are a lot of number combinations ... but if I use some math systems (like linear progression ... etc.) I can reduce combinations ... or if I insert some variable restictions (e. g. not considerer all sequential numbers extractions like for example 1,2,3,4,5,6 ... that very difficult to extract) i can to reduce number of combinations, ecc.
I ask if anyone know some script or function, or class o other tool usefull fo this job. PHP of course ...
Thanks
Statistical and math code/functions
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
function pickSome( $howMany, $numbers )
{
$final = $numbers;
$howMany = abs(intval($howMany));
if( !is_array($final)) $final = array();
shuffle($final);
return array_slice($final, 0, $howMany);
}Of course
Yes ... 123456 are the same probability of any other combination. But I'm looking for a system that allow to define criterials to reduce combinations number.
For that i'm looking fo a math/statistical implementation (in PHP) that allows to insert (for example) 30 numbers and to calculate all combinations of 6 numbers of these 30 numbers. At the same time I should got a system that allows to insert also restriction criterial (for example: calculate all number combination except the combinations that contain more than 4 sequenzial numbers ... for example 34, 45,46,47,48,49).
The restriction criterials are based on a teorical difficulty to extract weird combinations (for example 1,2,3,4,5,6 or, example above, 34,45,46,47,48,49) ...
My english is very very terrible .... sorry
Thanks
Clarkent
For that i'm looking fo a math/statistical implementation (in PHP) that allows to insert (for example) 30 numbers and to calculate all combinations of 6 numbers of these 30 numbers. At the same time I should got a system that allows to insert also restriction criterial (for example: calculate all number combination except the combinations that contain more than 4 sequenzial numbers ... for example 34, 45,46,47,48,49).
The restriction criterials are based on a teorical difficulty to extract weird combinations (for example 1,2,3,4,5,6 or, example above, 34,45,46,47,48,49) ...
My english is very very terrible .... sorry
Thanks
Clarkent
Re: Of course
With recursion you can write it quite easily yourself. Although i'm not going to do your homework, but i'll give you a sample (in euler)Clarkent wrote:Yes ... 123456 are the same probability of any other combination. But I'm looking for a system that allow to define criterials to reduce combinations number.
For that i'm looking fo a math/statistical implementation (in PHP) that allows to insert (for example) 30 numbers and to calculate all combinations of 6 numbers of these 30 numbers.
Code: Select all
function buildcombo(V)
if (cols(V) == 1);
return Vї1];
endif;
Combo = zeros(0, 0);
for i = 1 to cols(V);
nV = Vї1:i-1] | Vїi+1:cols(V)];
SCombo = buildcombo(nV);
for j = 1 to rows(SCombo);
Combo = Combo _ (Vїi] | SComboїj]);
end;
endif;
return Combo;
endfunctionClarkent wrote: At the same time I should got a system that allows to insert also restriction criterial (for example: calculate all number combination except the combinations that contain more than 4 sequenzial numbers ... for example 34, 45,46,47,48,49).
The restriction criterials are based on a teorical difficulty to extract weird combinations (for example 1,2,3,4,5,6 or, example above, 34,45,46,47,48,49) ...
So first you build all the possible combinations, and then you test each combination and (eventually) push it to the valid_combinations ...