Search notes:

PowerShell cmdLet: Get-Random

By default, get-random returns a System.Int32 whose value is between 0 and [System.Int]::MaxValue.
The range of return values can be restricted:
PS> get-random -minimum 1000 -maximum 2000
1620
The PRG can be seeded:
PS> get-random -setSeed 42
381294397
PS> get-random
1003291822
Select n random elements from an array:
PS> get-random -count 3 ('one', 'two', 'three', 'four', 'five')
one
five
three
Powershell 7 - Randomly permutate an array:
PS> get-random -shuffle ('one', 'two', 'three', 'four', 'five')
three
one
five
four
two

See also

PowerShell 7.4 adds the cmdlet get-secureRandom.

Index