Skip to content

Instantly share code, notes, and snippets.

@chateaux
Created January 21, 2016 07:25
Show Gist options
  • Save chateaux/1d4384db7d2d93be4e6e to your computer and use it in GitHub Desktop.
Save chateaux/1d4384db7d2d93be4e6e to your computer and use it in GitHub Desktop.
Lottery Prediction Script - average number from group selection
//Text file with numbers on each line
$lines = file('location/of/text/file.txt');
$i = 1;
$n = 1;
foreach ($lines as $line_num => $line) {
$array[$n][] = explode(' ',$line);
//Depending on the total numbers, you can group accordingly
if ($i % 96 == 0)
{
$n++;
}
$i ++;
}
foreach ($array AS $number_array)
{
$count = count($number_array);
$sum = [];
foreach ($number_array AS $key => $ticket)
{
foreach ($ticket AS $key => $number)
{
if (!isset($sum[$key])) $sum[$key] = 0;
$sum[$key] = $sum[$key] + $number;
}
}
foreach ($sum AS $div)
{
$x = round($div/$count)." ";
echo sprintf('%02d', $x)." ";
}
echo "<br/>";
}
die("Complete...");
//Try it our here: www.sun7lottery.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment