Prerequisites
Steps to reproduce
This is a sub-issue of #25242.
The cmdlet Get-SecureRandom does not respect explicit $false values for the -Shuffle switch parameter.
PS> $result = Get-SecureRandom -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false
PS> $result.Count
PS> $result
Expected behavior
PS> $result = Get-SecureRandom -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false
PS> $result.Count
1
PS> $result
5
-Shuffle:$false should behave the same as omitting the -Shuffle switch, returning a single random item from the input collection.
Actual behavior
PS> $result = Get-SecureRandom -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false
PS> $result.Count
6
PS> $result
3
13
1
8
2
5
-Shuffle:$false behaves the same as -Shuffle or -Shuffle:$true, returning all items in shuffled order.
Error details
No error is thrown. The cmdlet executes but ignores the explicit $false value.
Environment data
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
This is a sub-issue of #25242.
The cmdlet
Get-SecureRandomdoes not respect explicit$falsevalues for the-Shuffleswitch parameter.Expected behavior
-Shuffle:$falseshould behave the same as omitting the-Shuffleswitch, returning a single random item from the input collection.Actual behavior
-Shuffle:$falsebehaves the same as-Shuffleor-Shuffle:$true, returning all items in shuffled order.Error details
No error is thrown. The cmdlet executes but ignores the explicit
$falsevalue.Environment data
Visuals
No response