AzSpeedOps.psm1
function Get-RandomNumberOfNumbers { $AmmountOfRandomNumbers = Get-Random -Minimum 1 -Maximum 10 1..$AmmountOfRandomNumbers | ForEach-Object { Get-Random -Minimum 1 -Maximum 1000 } } function Get-NumberTrivia { Invoke-RestMethod -Method Get -Uri 'http://numbersapi.com/random/trivia' } function Measure-RandomNumbers { [CmdletBinding(DefaultParameterSetName = 'Sum')] param ( [Parameter(ParameterSetName = 'Sum')] [Switch] $Sum, [Parameter(ParameterSetName = 'Avg')] [Switch] $Average ) switch ($PSCmdlet.ParameterSetName) { Sum { (Get-RandomNumberOfNumbers | Measure-Object -Sum).Sum } Avg { [math]::Round((Get-RandomNumberOfNumbers | Measure-Object -Average).Average,2) } } } $PublicFunctions = 'Get-NumberTrivia', 'Measure-RandomNumbers' |