this script picks 9 random lucky numbers 2000 times and outputs it to a .csv file ,, it can be customized to suite other lotteries
$num = "2000" # how many games you like to play
$pick = "9" # how many numbers you like to use
$mynum = 19,33,25,40,20,5,3,27,2,7,35,21,28,17,34,6,16,1,29,8,44,22,13,37,26,41,43,23,15,39 # your lucky numbers
$file1 = "C:\Temp\random7.txt"
$file2 = "C:\Temp\random8.csv"
$file3 = "C:\Temp\random9.csv"
$file4 = "C:\Temp\random10.csv"
If (Test-Path($file1 )) {Remove-Item $file1}
If (Test-Path($file2 )) {Remove-Item $file2}
If (Test-Path($file3 )) {Remove-Item $file3}
If (Test-Path($file4 )) {Remove-Item $file4}
$numbers = for ($x = 1; $x -lt $num; $x++)
{
(Get-Random -InputObject ($mynum) -Count $pick | sort-object ) -join (",") | Out-File -Append -FilePath $file1
}
Get-Content $file1 | Foreach-Object {($_ -replace "\s+",",")}|Out-File -FilePath $file2 -Encoding OEM
Import-Csv -Delimiter "," -Header @("a","b","c","d","e","f","g","h","i") -Path $file2 | select a,b,c,d,e,f,g,h,i | ft -auto |Out-File -FilePath $file3 -Encoding OEM
$FileContent = gc $file3
$FileContent = $FileContent[3..($FileContent.Count - 2)]
$FileContent | Out-File $file3
Get-Content $file3| Foreach-Object {($_ -replace "\s+",",")}|Out-File -FilePath $file4 -Encoding OEM -Append
$content = Get-Content -Path $file4
$content -notmatch '(^[\s,-]*$)|(rows\s*affected)' | Set-Content -Path $file4
Start-Process $file4