Respect -Shuffle:$false in Get-SecureRandom by yotsuda · Pull Request #26460 · PowerShell/PowerShell · GitHub
Skip to content

Respect -Shuffle:$false in Get-SecureRandom - #26460

Merged
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
yotsuda:fix/get-securerandom-shuffle-26458
Nov 17, 2025
Merged

Respect -Shuffle:$false in Get-SecureRandom#26460
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
yotsuda:fix/get-securerandom-shuffle-26458

Conversation

@yotsuda

Copy link
Copy Markdown
Contributor

PR Summary

This PR adds a test case for Get-SecureRandom to verify the fix for -Shuffle:$false handling. The underlying issue was already fixed in PR #26457, which corrected the base class GetRandomCommandBase that Get-SecureRandom inherits from.

Fixes #26458
Related to #25242

PR Context

The cmdlet Get-SecureRandom inherits from GetRandomCommandBase, which was fixed in PR #26457 to correctly handle explicit -Shuffle:$false parameter values. Since the fix was made in the base class, it automatically applies to Get-SecureRandom as well.

This PR adds a test case to ensure the fix works correctly for Get-SecureRandom.

Changes

  • Added test case in Get-SecureRandom.Tests.ps1: "Should return a single random item when -Shuffle:$false is used"

Testing

  • The new test verifies that -Shuffle:$false returns exactly one item from the input collection
  • Pre-fix behavior: Returns all 6 items in shuffled order
  • Post-fix behavior: Returns 1 item as expected
  • All existing tests continue to pass

PR Checklist

@iSazonov Ilya (iSazonov) changed the title Fix: Respect -Shuffle:$false in Get-SecureRandom Respect -Shuffle:$false in Get-SecureRandom Nov 17, 2025
@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 17, 2025
@iSazonov

Copy link
Copy Markdown
Collaborator

@yotsuda
Yoshifumi (yotsuda) force-pushed the fix/get-securerandom-shuffle-26458 branch from 5343300 to 6704c3f Compare November 17, 2025 03:41
@iSazonov Ilya (iSazonov) self-assigned this Nov 17, 2025
@iSazonov
Ilya (iSazonov) merged commit e741cec into PowerShell:master Nov 17, 2025
43 of 45 checks passed
@yotsuda
Yoshifumi (yotsuda) deleted the fix/get-securerandom-shuffle-26458 branch November 18, 2025 00:27
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
Ryan Yates (kilasuit) pushed a commit to kilasuit/PowerShell that referenced this pull request Jan 2, 2026
Justin Grote (JustinGrote) pushed a commit to JustinGrote/PowerShell that referenced this pull request Jun 2, 2026
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Shuffle:$false not respected in Get-SecureRandom

2 participants