Title: -Shuffle:$false not respected in Get-Random · Issue #26456 · PowerShell/PowerShell · GitHub
Open Graph Title: -Shuffle:$false not respected in Get-Random · Issue #26456 · PowerShell/PowerShell
X Title: -Shuffle:$false not respected in Get-Random · Issue #26456 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/26456
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"-Shuffle:$false not respected in Get-Random","articleBody":"### Prerequisites\n\n- [x] Write a descriptive title.\n- [x] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [x] Search the existing issues.\n- [x] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [x] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nThis is a sub-issue of #25242.\n\nThe cmdlet `Get-Random` does not respect explicit `$false` values for the `-Shuffle` switch parameter.\n\n```powershell\nPS\u003e $result = Get-Random -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false\nPS\u003e $result.Count\nPS\u003e $result\n```\n\n### Expected behavior\n\n```console\nPS\u003e $result = Get-Random -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false\nPS\u003e $result.Count\n1\nPS\u003e $result\n5\n```\n\n`-Shuffle:$false` should behave the same as omitting the `-Shuffle` switch, returning a single random item from the input collection.\n\n### Actual behavior\n\n```console\nPS\u003e $result = Get-Random -InputObject 1, 2, 3, 5, 8, 13 -Shuffle:$false\nPS\u003e $result.Count\n6\nPS\u003e $result\n3\n13\n1\n8\n2\n5\n```\n\n`-Shuffle:$false` behaves the same as `-Shuffle` or `-Shuffle:$true`, returning all items in shuffled order.\n\n### Error details\n\nNo error is thrown. The cmdlet executes but ignores the explicit `$false` value.\n\n### Environment data\n\n```powershell\nPS\u003e $PSVersionTable\n\nName Value\n---- -----\nPSVersion 7.5.4\nPSEdition Core\nGitCommitId 7.5.4\nOS Microsoft Windows 10.0.26100\nPlatform Win32NT\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n```\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/yotsuda","@type":"Person","name":"yotsuda"},"datePublished":"2025-11-16T04:58:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/26456/PowerShell/issues/26456"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:32d7b830-5ea7-eb81-bd9a-8de57a45303f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A702:8AE8C:1F529E5:2B7B051:6A4ECF36 |
| html-safe-nonce | 380d55549bd6134e4193777536f99745bfda4c6c79950dea8f5670eee2d92a14 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzAyOjhBRThDOjFGNTI5RTU6MkI3QjA1MTo2QTRFQ0YzNiIsInZpc2l0b3JfaWQiOiI0OTcyOTA1MjYzODY0NDAxNzE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3ac1d0b1bbcde9687aca1dce794c6202cc8fa1491fd190b0591f96b3372142b0 |
| hovercard-subject-tag | issue:3629917831 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/26456/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aaaec2ce2423c38b3681ba16c057a4ca5ab3f9a3826f81572f33fad6cc4bf60c/PowerShell/PowerShell/issues/26456 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aaaec2ce2423c38b3681ba16c057a4ca5ab3f9a3826f81572f33fad6cc4bf60c/PowerShell/PowerShell/issues/26456 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yotsuda |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width