Korean lottery is a game to select 6 numbers out of number range from 1 to 45 without same number and regardless order. 1st prize winner is one who gets all 6 numbers matched which are randomly chosen by lottery number picker machine.
PowerShell provides "Get-Random" built-in command which makes things quite easy. To print out 6 numbers in the range between 1 to 45, one line script does it all.
1..45 | Get-Random -count 6 | sort
2
32
35
36
39
40
Get-Random (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn
Get-Random (Microsoft.PowerShell.Utility) - PowerShell
The Get-Random cmdlet gets a randomly selected number. If you submit a collection of objects to Get-Random, it gets one or more randomly selected objects from the collection. Without parameters or input, a Get-Random command returns a randomly selected 32-
learn.microsoft.com
Easy-peasy..
'ICT' 카테고리의 다른 글
[PowerShell] GUI(Graphic User Interface) with XAML (0) | 2023.05.18 |
---|---|
[DailyLog] 2023-05-11(목) (0) | 2023.05.12 |
[PowerShell]9. Learning Projects - Finding prime numbers (0) | 2023.05.08 |
[PowerShell]8. Exception(error) Handling (0) | 2023.05.02 |
[PowerShell]Moving Computers from OSD Folder (0) | 2023.04.24 |
댓글