tag:blogger.com,1999:blog-37819735.post2600759782365994232..comments2023-11-02T16:16:25.855+01:00Comments on JBs Powershell: Sort-RandomJakob Bindslethttp://www.blogger.com/profile/15991115017499294057noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-37819735.post-40041723465569270842013-10-28T16:25:56.268+01:002013-10-28T16:25:56.268+01:00Hi Jakob,
I need a help on sorting user defined n...Hi Jakob,<br /><br />I need a help on sorting user defined numbers.<br />Say user entered 10 numbers , then the output should be in sorted order.<br />vaibhavhttps://www.blogger.com/profile/14352530598168807818noreply@blogger.comtag:blogger.com,1999:blog-37819735.post-69568162174547690462009-07-06T21:38:32.637+02:002009-07-06T21:38:32.637+02:00Yes, but we are still waiting for version 2.0 ;-)Yes, but we are still waiting for version 2.0 ;-)Jakob Bindslethttps://www.blogger.com/profile/15991115017499294057noreply@blogger.comtag:blogger.com,1999:blog-37819735.post-79553357837656266182009-07-06T20:38:14.384+02:002009-07-06T20:38:14.384+02:00V2 supports this through Get-Random!
1,2,3 | Get-...V2 supports this through Get-Random!<br /><br />1,2,3 | Get-Random -Count 3<br /><br />Lee Holmes [MSFT]<br />Windows PowerShell Development<br />Microsoft CorporationAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-37819735.post-23442045330848504572008-08-15T22:30:00.000+02:002008-08-15T22:30:00.000+02:00Here's another easy way to sort randomly. It uses...Here's another easy way to sort randomly. It uses a GUID to sort randomly. GUIDs aren't trully random, but they are very close and don't repeat.<BR/>1..100 | sort {[System.Guid]::NewGuid()}<BR/><BR/>Or, if you can't remember how to get the guid, then create a function:<BR/><BR/>function New-GUID {[System.Guid]::NewGuid()}<BR/><BR/>Then use the function to sort:<BR/>1..100 | sort { New-GUID }<BRAnonymousnoreply@blogger.com