diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs index c914174b04ecf..33c4be5c8e43e 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs @@ -1357,13 +1357,13 @@ internal virtual HttpResponseMessage GetResponse(HttpClient client, HttpRequestM if (string.Equals(RetryMode, "Exponential", StringComparison.OrdinalIgnoreCase)) { // If RetryMode is specified as "Exponential", use the exponential backoff algorithm to determine the retry interval. - retryIntervalInSeconds = Math.Min(retryIntervalInSeconds * MathF.Pow(2, exponent), _maximumRetryIntervalInSeconds); + retryIntervalInSeconds = MathF.Min(retryIntervalInSeconds * MathF.Pow(2, exponent), _maximumRetryIntervalInSeconds); } else if (string.Equals(RetryMode, "ExponentialJitter", StringComparison.OrdinalIgnoreCase)) { // If RetryMode is specified as "ExponentialJitter", use the exponential backoff with jitter algorithm to determine the retry interval. Random random = new(); - retryIntervalInSeconds = Math.Min(retryIntervalInSeconds * MathF.Pow(2, exponent) * random.NextDouble(), _maximumRetryIntervalInSeconds); + retryIntervalInSeconds = MathF.Min(retryIntervalInSeconds * MathF.Pow(2, exponent) * (float)random.NextDouble(), _maximumRetryIntervalInSeconds); } // If the status code is 429 get the retry interval from the Headers.