Created
January 31, 2014 21:07
-
-
Save toenuff/8743160 to your computer and use it in GitHub Desktop.
NYC PowerShell User Group gist for giveaway lottery - nice for football pools too :P
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$firstnumber = 0 | |
$lastnumber = 9 | |
$numberofwinners = 10 | |
$numbers = new-object System.collections.arraylist | |
($firstnumber..$lastnumber) |%{ $numbers.add($_) |out-null} | |
function Get-NextNumber { | |
param ( | |
[Parameter(Mandatory=$true, Position=0)] | |
[System.collections.arraylist] $numbers | |
) | |
$number = $numbers |Get-Random | |
$number | |
$numbers.remove($number) | |
} | |
(1..$numberofwinners) |% { | |
Get-NextNumber $numbers | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment