diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Get-Random.md b/reference/5.1/Microsoft.PowerShell.Utility/Get-Random.md index 15366823e80a..72bd3f1c03b1 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Get-Random.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Get-Random.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 06/25/2023 +ms.date: 12/11/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-random?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Get-Random @@ -40,14 +40,16 @@ You can use the parameters of `Get-Random` to specify the minimum and maximum va objects returned from a collection, or a seed number. > [!CAUTION] -> This seed value is used for the current command and for all subsequent `Get-Random` commands in -> the current session until you use **SetSeed** again or close the session. You can't reset the seed -> to its default value. +> `Get-Random` doesn't ensure cryptographically secure randomness. The seed value is used for the +> current command and for all subsequent `Get-Random` commands in the current session until you use +> **SetSeed** again or close the session. You can't reset the seed to its default value. > > Deliberately setting the seed results in non-random, repeatable behavior. It should only be used > when trying to reproduce behavior, such as when debugging or analyzing a script that includes > `Get-Random` commands. Be aware that the seed value could be set by other code in the same > session, such as an imported module. +> +> PowerShell 7.4 includes `Get-SecureRandom`, which ensures cryptographically secure randomness. ## EXAMPLES @@ -178,7 +180,7 @@ Get-Random -Maximum 100 ``` ```powershell -# Commands with the same seed are not random +# Commands with the same seed aren't random Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 @@ -399,7 +401,6 @@ the output type for each of the numeric input types. | Double | Double | | Single | Double | -Beginning in Windows PowerShell 3.0, `Get-Random` supports 64-bit integers. In Windows PowerShell -2.0, all values are cast to **System.Int32**. +Beginning in Windows PowerShell 3.0, `Get-Random` supports 64-bit integers. ## RELATED LINKS diff --git a/reference/7.2/Microsoft.PowerShell.Utility/Get-Random.md b/reference/7.2/Microsoft.PowerShell.Utility/Get-Random.md index cd085754d8b3..ac4e1799cacc 100644 --- a/reference/7.2/Microsoft.PowerShell.Utility/Get-Random.md +++ b/reference/7.2/Microsoft.PowerShell.Utility/Get-Random.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 06/25/2023 +ms.date: 12/11/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-random?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Get-Random @@ -46,14 +46,16 @@ You can use the parameters of `Get-Random` to specify the minimum and maximum va objects returned from a collection, or a seed number. > [!CAUTION] -> This seed value is used for the current command and for all subsequent `Get-Random` commands in -> the current session until you use **SetSeed** again or close the session. You can't reset the seed -> to its default value. +> `Get-Random` doesn't ensure cryptographically secure randomness. The seed value is used for the +> current command and for all subsequent `Get-Random` commands in the current session until you use +> **SetSeed** again or close the session. You can't reset the seed to its default value. > > Deliberately setting the seed results in non-random, repeatable behavior. It should only be used > when trying to reproduce behavior, such as when debugging or analyzing a script that includes > `Get-Random` commands. Be aware that the seed value could be set by other code in the same > session, such as an imported module. +> +> PowerShell 7.4 includes `Get-SecureRandom`, which ensures cryptographically secure randomness. ## EXAMPLES @@ -180,7 +182,7 @@ Get-Random -Maximum 100 ``` ```powershell -# Commands with the same seed are not random +# Commands with the same seed aren't random Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 diff --git a/reference/7.3/Microsoft.PowerShell.Utility/Get-Random.md b/reference/7.3/Microsoft.PowerShell.Utility/Get-Random.md index 6352e9f6f9f6..67248c99eb20 100644 --- a/reference/7.3/Microsoft.PowerShell.Utility/Get-Random.md +++ b/reference/7.3/Microsoft.PowerShell.Utility/Get-Random.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 06/25/2023 +ms.date: 12/11/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-random?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: Get-Random @@ -46,14 +46,16 @@ You can use the parameters of `Get-Random` to specify the minimum and maximum va objects returned from a collection, or a seed number. > [!CAUTION] -> This seed value is used for the current command and for all subsequent `Get-Random` commands in -> the current session until you use **SetSeed** again or close the session. You can't reset the seed -> to its default value. +> `Get-Random` doesn't ensure cryptographically secure randomness. The seed value is used for the +> current command and for all subsequent `Get-Random` commands in the current session until you use +> **SetSeed** again or close the session. You can't reset the seed to its default value. > > Deliberately setting the seed results in non-random, repeatable behavior. It should only be used > when trying to reproduce behavior, such as when debugging or analyzing a script that includes > `Get-Random` commands. Be aware that the seed value could be set by other code in the same > session, such as an imported module. +> +> PowerShell 7.4 includes `Get-SecureRandom`, which ensures cryptographically secure randomness. ## EXAMPLES @@ -180,7 +182,7 @@ Get-Random -Maximum 100 ``` ```powershell -# Commands with the same seed are not random +# Commands with the same seed aren't random Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Get-Random.md b/reference/7.4/Microsoft.PowerShell.Utility/Get-Random.md index 6f0d585980ce..fc04ce9d1f1a 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Get-Random.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Get-Random.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 06/25/2023 +ms.date: 12/11/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-random?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Get-Random @@ -46,16 +46,17 @@ You can use the parameters of `Get-Random` to specify the minimum and maximum va objects returned from a collection, or a seed number. > [!CAUTION] -> This seed value is used for the current command and for all subsequent `Get-Random` commands in -> the current session until you use **SetSeed** again or close the session. You can't reset the seed -> to its default value. +> `Get-Random` doesn't ensure cryptographically secure randomness. The seed value is used for the +> current command and for all subsequent `Get-Random` commands in the current session until you use +> **SetSeed** again or close the session. You can't reset the seed to its default value. > > Deliberately setting the seed results in non-random, repeatable behavior. It should only be used > when trying to reproduce behavior, such as when debugging or analyzing a script that includes > `Get-Random` commands. Be aware that the seed value could be set by other code in the same > session, such as an imported module. > -> `Get-Random` does not ensure cryptographically secure randomness and it is recommended to use [Get-SecureRandom](Get-SecureRandom.md) instead. +> PowerShell 7.4 includes [Get-SecureRandom](Get-SecureRandom.md), which ensures cryptographically +> secure randomness. ## EXAMPLES @@ -182,7 +183,7 @@ Get-Random -Maximum 100 ``` ```powershell -# Commands with the same seed are not random +# Commands with the same seed aren't random Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23 Get-Random -Maximum 100 -SetSeed 23