Generate random number using Powershell

Standard

randomI was faced with an opportunity that I had to create a set of random numbers really quick.
The question was to create a list of numbers starting from 1 to 9999 and supply a list with this range where each number was only used once and was placed in the list randomly.

Because Powershell is my first choice as scripting language I searched for a function in Powershell that handles random numbers.

I eventually created the script below:

This code takes an array of the value 1 to 9999 and outputs the random number to a text file.

Leave a Reply