PowerTip: Select Two Random Numbers from 20 Possibilities

Doctor Scripto

Dr Scripto

Summary: Use Windows PowerShell to select two random numbers from twenty possible numbers.

Hey, Scripting Guy! Question  How can I use Windows PowerShell to select two of twenty attendees at user group to receive prizes?

Hey, Scripting Guy! Answer  Create a range of input numbers with the Get-Random cmdlet, then use the –Count parameter to retrieve
           two random numbers:

Get-Random -InputObject (1..20) -Count 2

0 comments

Leave a comment