mardi 27 janvier 2015

Randomize a List of Elements in a Powershell Array

I'm looking to take an array of elements and return a randomized version of the array in a function.


For example:



function Randomize-List
{
Param(
[int[]]$InputList
)
...code...
return 10,7,2,6,5,3,1,9,8,4
}

$a = 1..10
Write-Output (Randomize-List -InputList $a)
10
7
2
...


You get the idea. No idea of how to approach this, I'm new to Powershell, coming from a Python background.





Aucun commentaire:

Enregistrer un commentaire