June 28th, 2015

PowerTip: Select Two Random Numbers from 20 Possibilities

Doctor Scripto
Scripter

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

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback