powershell - Powershell:获取两个随机的独立数字

标签 powershell

对于Get-Random,如何获得随机数并使结果看起来像这样?

'100,100'

最佳答案

您需要使用-Count参数。不幸的是,您将需要通过管道为它提供最小/最大。

# String
(1..100 | Get-Random -Count 2) -join ',' 
# Array
1..100 | Get-Random -Count 2 

可以在MS Page上找到有关Get-Random的更多详细信息。

关于powershell - Powershell:获取两个随机的独立数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59761873/

相关文章:

powershell - gt/ge运算符不适用于Powershell函数中的where对象

c# - 调试 PowerShell 脚本

powershell - 记录某些东西的最佳PowerShell动词?

powershell - 空暂存槽的 Azure 诊断扩展冲突错误 (Azure SDK 2.6)

Powershell 检查 IIS 中是否存在 MIME

xml - 如何在 PowerShell 中为 XML 添加子元素

具有多个输入字段的 Powershell 输入框

azure - 使用内置系统变量创建 Powershell 环境变量

powershell - 无法在二进制模块中创建 Powershell 别名

c# - 如何从 PowerShell 创建的枚举中获取值