Skip to content

Instantly share code, notes, and snippets.

@saggie
Created April 25, 2017 14:57
Show Gist options
  • Save saggie/627ea0a1537e2402a9b5e0d5c9b95426 to your computer and use it in GitHub Desktop.
Save saggie/627ea0a1537e2402a9b5e0d5c9b95426 to your computer and use it in GitHub Desktop.
$candidates = @(
'A',
'B',
'C',
'D',
'E',
'F'
)
$winners = @()
while ($winners.Count -lt 5)
{
$winningNumber = Get-Random -Maximum $candidates.Count
if ($candidates[$winningNumber] -ne $null)
{
$winners += $candidates[$winningNumber]
$candidates[$winningNumber] = $null
}
}
Write-Output $winners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment