Use PowerShell to win the lottery!

Good morning and happy new year!

It just occurred to me that this could be the year where I win the lottery. Of course first I would have to play in the lottery, and then there’s the small matter of hitting the right numbers.

If you need to quickly find say 6 out of 45 (Swiss Lottery), you could delegate that job to PowerShell:

Get-Random -InputObject (1..45) -count ([int]::MaxValue) | select -First 6

This will randomize the order of all numbers between 1 and 45 and display only the first 6.

P.S.: Should you hit the lottery with my script don’t forget to send 10% my way. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *