RosettaCodeData/Task/Send-an-unknown-method-call/PowerShell/send-an-unknown-method-call.psh
2023-07-01 13:44:08 -04:00

10 lines
318 B
Text

$method = ([Math] | Get-Member -MemberType Method -Static | Where-Object {$_.Definition.Split(',').Count -eq 1} | Get-Random).Name
$number = (1..9 | Get-Random) / 10
$result = [Math]::$method($number)
$output = [PSCustomObject]@{
Method = $method
Number = $number
Result = $result
}
$output | Format-List