(I'm assuming that your X is known beforehand – represented by the variable $x
in the following code).
Since you weren't adverse to a PowerShell solution:
Get-ChildItem SomeFolder | Get-Random -Count $x | Move-Item -Destination SomeOtherFolder
or shorter:
gci somefolder | random -c $x | mi -dest someotherfolder
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…