Skip to content

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

Merged
iSazonov merged 1 commit intoPowerShell:masterfrom
yotsuda:fix/get-securerandom-shuffle-26458
Nov 17, 2025
Merged

Respect -Shuffle:$false in Get-SecureRandom#26460
iSazonov merged 1 commit intoPowerShell:masterfrom
yotsuda:fix/get-securerandom-shuffle-26458

Conversation

@yotsuda
Copy link
Contributor

@yotsuda yotsuda commented Nov 16, 2025

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 iSazonov changed the title Fix: Respect -Shuffle:$false in Get-SecureRandom Respect -Shuffle:$false in Get-SecureRandom Nov 17, 2025
@iSazonov 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
Collaborator

@yotsuda Please rebase to get related fix.

@yotsuda yotsuda force-pushed the fix/get-securerandom-shuffle-26458 branch from 5343300 to 6704c3f Compare November 17, 2025 03:41
@iSazonov iSazonov self-assigned this Nov 17, 2025
@iSazonov iSazonov merged commit e741cec into PowerShell:master Nov 17, 2025
43 of 45 checks passed
@yotsuda 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
kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request Jan 2, 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