Showing posts with label random. Show all posts
Showing posts with label random. Show all posts

Tuesday, January 8, 2019

Fun PowerShell

Roll fair dice

Input the number of pips on the die
Input the number of rolls

reference doc.microsoft.com
PS /> 1..1200 | ForEach-Object { 1..6 | Get-Random } | Group-Object | Select-Object Name,Count
Name Count
---- -----
1      206
2      199
3      196
4      226
5      185
6      188
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-random?view=powershell-6